Skip to content

Commit

Permalink
fix(cli): improve error message of cli
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Aug 19, 2024
1 parent 75852f2 commit f3bcadb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
22 changes: 14 additions & 8 deletions cli/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
);
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions cli/folder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
}
}
Expand Down
18 changes: 13 additions & 5 deletions cli/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit f3bcadb

Please sign in to comment.