This commit is contained in:
Adria Navarro 2024-03-15 10:18:47 +01:00
parent 9671399ca8
commit 9dac9d0a3d
2 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ export const removeJSRunner = () => {
runJS = undefined
}
let onErrorLog: (message: string) => void
let onErrorLog: (message: Error) => void
export const setOnErrorLog = (delegate: typeof onErrorLog) =>
(onErrorLog = delegate)
@ -63,7 +63,7 @@ export function processJS(handlebars: string, context: any) {
// Create a sandbox with our context and run the JS
const res = { data: runJS(js, sandboxContext) }
return `{{${LITERAL_MARKER} js_result-${JSON.stringify(res)}}}`
} catch (error) {
} catch (error: any) {
onErrorLog && onErrorLog(error)
if (error.code === "ERR_SCRIPT_EXECUTION_TIMEOUT") {

View File

@ -20,7 +20,7 @@ const addedHelpers = {
duration: duration,
}
let helpers: Record<string, any> = undefined
let helpers: Record<string, any>
export function getJsHelperList() {
if (helpers) {