From 2cd1d7b683a2cffce5640923c97d790a26de6c48 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Fri, 25 Aug 2023 07:58:48 +0200 Subject: [PATCH] better error catching --- src/Evaluator.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Evaluator.ts b/src/Evaluator.ts index c9130c7..d5659ed 100644 --- a/src/Evaluator.ts +++ b/src/Evaluator.ts @@ -18,7 +18,9 @@ const tryCatchWrapper = ( return new Promise((resolve, _) => { try { Function( - `"use strict";try{${codeReplace(code)}} catch (e) {console.log(e); _reportError(e);};` + `"use strict";try{${codeReplace( + code + )}} catch (e) {console.log(e); _reportError(e);};` ).call(application.api); resolve(true); } catch (error) { @@ -64,7 +66,7 @@ export const tryEvaluate = async ( const newFunction = new Function( `"use strict";try{${codeReplace( wrappedCode - )}} catch (e) {console.log(e)};` + )}} catch (e) {console.log(e); _reportError(e);};` ); addFunctionToCache(candidateCode, newFunction); } else {