Skip to content

Commit 25341f6

Browse files
committed
Another edge case that slipped through for crash reporter
In JavaScript you can throw literally anything as an error which will not have a stack trace and needs to be serialized as well
1 parent 15a7f60 commit 25341f6

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
// Syntax highlighting for Jinja templates
4343
"files.associations": {
44-
"**/templates/*.html": "jinja",
44+
"**/templates/*.html": "jinja-html",
4545
"**/logFile_*.txt": "log",
4646
},
4747

templates/game.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@
173173
// Catch all exceptions that escape into the browser
174174
window.onerror = (event, source, line, column, error) =>
175175
{
176-
sendErrorLog(error.message, error.stack);
176+
// JavaScript allows you to throw literally anything as an exception,
177+
// but only Error objects will have a valid stack trace
178+
if(error instanceof Error)
179+
sendErrorLog(error.message, error.stack);
180+
else
181+
sendErrorLog(JSON.stringify(error), [source, line, column].join(':'));
177182
return false;
178183
};
179184

0 commit comments

Comments
 (0)