From 2e4607edb60206f0c9f4ca281e49c57d7b4d8dea Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Fri, 4 Oct 2024 11:13:30 +0100 Subject: [PATCH] Ensure processObjectSync does not throw. --- packages/string-templates/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/string-templates/src/index.ts b/packages/string-templates/src/index.ts index 0f5326374f..55b2587b99 100644 --- a/packages/string-templates/src/index.ts +++ b/packages/string-templates/src/index.ts @@ -179,7 +179,11 @@ export function processObjectSync( for (let key of Object.keys(object || {})) { let val = object[key] if (typeof val === "string") { - object[key] = processStringSync(object[key], context, opts) + try { + object[key] = processStringSync(object[key], context, opts) + } catch (error: any) { + object[key] = error.toString() + } } else if (typeof val === "object") { object[key] = processObjectSync(object[key], context, opts) }