You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Chat parse error alert shows the stack trace in the alert body #1653
When a chat message fails to parse three times in a row, the error alert prints the whole stack trace in the alert body:
Error while parsing chat message: true, Failed to fetch, TypeError: Failed to fetch
at jz (http://tauri.localhost/assets/database.svelte-6wcmeoV8.js:2210:1862)
at Az (http://tauri.localhost/assets/database.svelte-6wcmeoV8.js:2209:349)
...
This happens when the network is unstable or the server is down.
The alert body is meant for a short error message. Stacks are supposed to go to the "Show error details" panel, which also translates them with source maps and has a copy button. That panel does not appear for this error.
The message also contains a stray true, (or false,), which means nothing to the user.
Cause
markParsing in src/lib/ChatScreens/ChatBody.svelte calls alertError with one string:
alertError(`Error while parsing chat message: ${translated}, ${error.message}, ${error.stack}`)
alertError (src/ts/alert.ts) only moves the stack into stackTrace when it receives an Error. A string goes into msg as is, so the stack ends up in the body and stackTrace stays empty. The true, is the component's translated flag.
Suggested fix
Wrap the message in a new Error, copy the original stack onto it, pass that Error to alertError, and drop translated from the message.
Activity