Parcourir la source

Finished error handler

tags/v0.7.0
Fen Dweller il y a 8 ans
Parent
révision
9989410acf
2 fichiers modifiés avec 13 ajouts et 6 suppressions
  1. +9
    -2
      game.js
  2. +4
    -4
      stroll.html

+ 9
- 2
game.js Voir le fichier

@@ -2,9 +2,16 @@


/*jshint browser: true*/ /*jshint browser: true*/


let errored = false;

window.onerror = function(msg, source, lineno, colno, error) { 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 // do da dark mode


+ 4
- 4
stroll.html Voir le fichier

@@ -4,10 +4,10 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Stroll</title> <title>Stroll</title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<script src="units.js" crossorigin="anonymous"></script>
<script src="recursive-macro.js" crossorigin="anonymous"></script>
<script src="recursive-desc.js" crossorigin="anonymous"></script>
<script src="game.js" crossorigin="anonymous"></script>
<script src="units.js"></script>
<script src="recursive-macro.js"></script>
<script src="recursive-desc.js"></script>
<script src="game.js"></script>
</head> </head>
<body class="light"> <body class="light">
<div class="game-area"> <div class="game-area">


Chargement…
Annuler
Enregistrer