Skip to content

Commit

Permalink
fix: js code block error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Kholid060 committed Sep 4, 2023
1 parent 72cc181 commit 72b22fe
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/workflowEngine/utils/javascriptBlockUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,21 @@ export function jsContentHandler($blockData, $preloadScripts, $automaScript) {
}

onNextBlock = ({ detail }) => {
cleanUp(detail || {});
cleanUp();
if (!detail) {
resolve({ columns: {}, variables: {} });
return;
}

const payload = {
insert: detail.insert,
data: detail.data?.$error
? detail.data
: JSON.stringify(detail?.data ?? {}),
};
resolve({
columns: {
insert: detail?.insert,
data: JSON.stringify(detail?.data ?? {}),
},
variables: detail?.refData?.variables,
columns: payload,
variables: detail.refData?.variables,
});
};
onResetTimeout = () => {
Expand Down

0 comments on commit 72b22fe

Please sign in to comment.