From 9989410acf9c0ca580d785b59c573b1045140b9d Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Mon, 26 Feb 2018 14:31:20 -0500 Subject: [PATCH] Finished error handler --- game.js | 11 +++++++++-- stroll.html | 8 ++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/game.js b/game.js index 906e5bb..79960ec 100644 --- a/game.js +++ b/game.js @@ -2,9 +2,16 @@ /*jshint browser: true*/ +let errored = false; + window.onerror = function(msg, source, lineno, colno, error) { - let line = "in: " + source + " at line: " + lineno + ", col: " + colno; - alert("Error! " + msg + error); + if (!errored) { + errored = true; + + alert("An error occurred! Please press F12 to open the dev tools, then click the 'Console' tab and send any errors shown there to chemicalcrux\n\nScreenshotting the text and line number of the error would be great.\n\nAlso include the browser information that gets logged below it."); + + console.log(navigator.userAgent); + } } // do da dark mode diff --git a/stroll.html b/stroll.html index be8a47c..6f1bb56 100644 --- a/stroll.html +++ b/stroll.html @@ -4,10 +4,10 @@ Stroll - - - - + + + +