fix(cli): improve error message of cli

This commit is contained in:
Ruben Fiszel
2024-08-19 22:18:56 +02:00
parent 75852f27b5
commit f3bcadbfb1
3 changed files with 28 additions and 15 deletions
+14 -8
View File
@@ -115,14 +115,20 @@ export async function pushFlow(
});
} else {
log.info(colors.bold.yellow("Creating new flow..."));
await FlowService.createFlow({
workspace: workspace,
requestBody: {
path: remotePath.replaceAll(SEP, "/"),
deployment_message: message,
...localFlow,
},
});
try {
await FlowService.createFlow({
workspace: workspace,
requestBody: {
path: remotePath.replaceAll(SEP, "/"),
deployment_message: message,
...localFlow,
},
});
} catch (e) {
throw new Error(
`Failed to create flow ${remotePath}: ${e.body ?? e.message}`
);
}
}
}
+1 -2
View File
@@ -92,8 +92,7 @@ export async function pushFolder(
},
});
} catch (e) {
console.error(e.body);
throw e;
throw Error(`Failed to create folder ${name}: ${e.body ?? e.message}`);
}
}
}
+13 -5
View File
@@ -366,11 +366,19 @@ async function createScript(
workspace: Workspace
) {
if (!bundleContent) {
// no parent hash
await ScriptService.createScript({
workspace: workspaceId,
requestBody: body,
});
try {
// no parent hash
await ScriptService.createScript({
workspace: workspaceId,
requestBody: body,
});
} catch (e) {
throw Error(
`Script creation for ${body.path} with parent ${
body.parent_hash
} was not successful: ${e.body ?? e.message}`
);
}
} else {
const form = new FormData();
form.append("script", JSON.stringify(body));