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

View File

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