From 75a2c3e5ea8cf9c46767394ce4eba631434a9b9c Mon Sep 17 00:00:00 2001 From: Pete Linnegan Date: Wed, 25 Sep 2024 11:30:18 +0100 Subject: [PATCH] chore: modify nested menu message --- render/src/nestedMenu/src/loadNestedMenu.service.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/render/src/nestedMenu/src/loadNestedMenu.service.ts b/render/src/nestedMenu/src/loadNestedMenu.service.ts index cb1eec7..5f99cf9 100644 --- a/render/src/nestedMenu/src/loadNestedMenu.service.ts +++ b/render/src/nestedMenu/src/loadNestedMenu.service.ts @@ -9,11 +9,16 @@ export async function loadNestedMenu(content:string):Promise{ initNestedMenu(nestedMenu) return content.replace(menuRe, '
') } catch (e: any) { + const nestErrMsg = (content?: string) => ` +
+

Nested Menu Syntax Error

+ ${content ? content : ''} +
+ ` if ('message' in e) { - return content.replace(menuRe, `
There was an error with the nested menu syntax:\n${e.message}
`) + return content.replace(menuRe, nestErrMsg(e.message)) } else { - return content.replace(menuRe, '
There was an error parsing the nested menu syntax
') + return content.replace(menuRe, nestErrMsg()) } - } } \ No newline at end of file