feat: Capture unhandled errors by restructuring apps

This commit is contained in:
Faruk AYDIN
2022-10-21 19:03:24 +02:00
parent 525472d3e0
commit 9a743fb4a8
16 changed files with 92 additions and 76 deletions

View File

@@ -20,5 +20,23 @@ export const processFlow = async (options: ProcessFlowOptions) => {
testRun: options.testRun,
});
return await triggerCommand.run($);
try {
await triggerCommand.run($);
} catch (error) {
if (error?.response?.httpError) {
$.output.error = error.response.httpError;
} else {
try {
$.output.error = JSON.parse(error.message);
} catch {
$.output.error = { error: error.message };
}
}
}
if (triggerCommand?.sort) {
triggerCommand.sort($);
}
return $.output;
};