feature(user-menu) improve error handling

This commit is contained in:
coderaiser 2019-08-20 22:29:28 +03:00
parent b8592d35c0
commit 64e6b8387a
5 changed files with 109 additions and 14 deletions

View file

@ -72,13 +72,16 @@ async function onGET({req, res, menuName}) {
if (parseError)
return res
.type('js')
.send(`
throw Error(\`<pre>path: ${menuPath}\n\n${codeframe({
error: parseError,
source,
highlightCode: false,
})}
.send(`const e = Error(\`<pre>path: ${menuPath}\n\n${codeframe({
error: parseError,
source,
highlightCode: false,
})}
</pre>\`);
e.code = 'frame';
throw e;
`);
res