Skip to content

Commit e147b91

Browse files
committed
Additional fix for handling edge cases such as console.log(window)
1 parent 071b095 commit e147b91

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Assets/WebGLTemplates/Develop/debug-console.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,14 @@ function setupConsoleLogPipe() {
285285
}
286286
else {
287287
consoleLogFunction(message);
288-
htmlLog(JSON.stringify(message), logLevel);
288+
// Try to also log the object to the html console (does not always work in a meaningful manner)
289+
var htmlMessage;
290+
try {
291+
htmlMessage = JSON.stringify(message);
292+
} catch (error) {
293+
htmlMessage = `Can't convert message to JSON: ${error}`;
294+
}
295+
htmlLog(htmlMessage, logLevel);
289296
}
290297
};
291298

0 commit comments

Comments
 (0)