diff --git a/server/user-menu.js b/server/user-menu.js index b297648c..c68a5313 100644 --- a/server/user-menu.js +++ b/server/user-menu.js @@ -72,23 +72,27 @@ async function onGET({req, res, menuName}) { if (parseError) return res .type('js') - .send(`const e = Error(\`
path: ${menuPath}\n\n${codeframe({
-                error: parseError,
-                source,
-                highlightCode: false,
-            })}
-                
\`); - - e.code = 'frame'; - - throw e; - `); + .send(getError(parseError, source)); res .type('js') .send(result.code); } +function getError(parseError, source) { + return ` + const e = Error(\`
${codeframe({
+        error: parseError,
+        source,
+        highlightCode: false,
+    })}
\`); + + e.code = 'frame'; + + throw e; + `; +} + function sendDefaultMenu(res) { res.sendFile(DEFAULT_MENU_PATH, { cacheControl: false,