From 28e6a039292e65b1df9347671999aa858253747c Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Fri, 4 Oct 2024 10:32:33 +0100 Subject: [PATCH] Include syntax errors in processJS --- packages/string-templates/src/helpers/javascript.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/string-templates/src/helpers/javascript.ts b/packages/string-templates/src/helpers/javascript.ts index d5183ef3ed..ed8d4ad6d7 100644 --- a/packages/string-templates/src/helpers/javascript.ts +++ b/packages/string-templates/src/helpers/javascript.ts @@ -126,7 +126,10 @@ export function processJS(handlebars: string, context: any) { throw error } - // If all else fails, generic error message. + if (error.name === "SyntaxError") { + return error.toString() + } + return "Error while executing JS" } }