From 43d75423654e18b878b93a75ddbcaee0d09d6149 Mon Sep 17 00:00:00 2001 From: smallstonesk <575913857@qq.com> Date: Tue, 19 Jan 2021 00:49:57 +0800 Subject: [PATCH] fix: catch error for executing code online --- packages/compile-code/src/template/runOnline.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/compile-code/src/template/runOnline.ts b/packages/compile-code/src/template/runOnline.ts index f2091ec..e3a48da 100644 --- a/packages/compile-code/src/template/runOnline.ts +++ b/packages/compile-code/src/template/runOnline.ts @@ -60,7 +60,10 @@ const makeCode = (mockNode: any, mockInput: any) => ` const context = ctx.getContext(); window.dispatchEvent(new CustomEvent('iMoveOnlineExecEnds', {detail: {pipe, context}})); }); -})(); +})().catch(err => { + console.error(err.message); + window.dispatchEvent(new CustomEvent('iMoveOnlineExecEnds', {detail: {error: {message: err.message}}})); +}); `; export default makeCode;