Blue screen of death when theres an error

This commit is contained in:
Eric Fredricksen
2021-12-15 11:04:03 -08:00
parent 7c97694a28
commit a1622ce802
3 changed files with 62 additions and 0 deletions
+33
View File
@@ -145,6 +145,39 @@ body.iOS div.hint {
visibility: visible; visibility: visible;
} }
#bsodmom {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
vertical-align: middle;
display: none;
}
#bsod {
width: 500px;
background-color: #008;
color: white;
font-family: courier, monospace;
font-size: 14px;
margin: auto;
margin-top: 100px;
padding: 40px;
}
#bsod p {
text-align: left;
margin: 1em;
}
#bsod p.c {
text-align: center !IMPORTANT;
}
#bsod p.c span {
background: silver;
color: #008;
}
div#paused { div#paused {
display: none; display: none;
position: absolute; position: absolute;
+13
View File
@@ -186,6 +186,19 @@
</div> </div>
<div id=bsodmom>
<div id=bsod>
<p class=c><span>&nbsp;Progress Quest&nbsp;</span>
<p>&nbsp;
<p>An error has occurred.
<p>Error:
<p id=bsod_message>
<p>In <span id=bsod_source></span> at <span id=bsod_lineno></span>:<span id=bsod_colno></span>
<p id=bsod_error>
<p class=c>Press any key to continue...</p>
</div>
</div>
<div id="paused"><br>PAUSED</div> <div id="paused"><br>PAUSED</div>
</body> </body>
+16
View File
@@ -1156,13 +1156,29 @@ function ToDna(s) {
return r; return r;
} }
window.onerror = function(message, source, lineno, colno, error) {
$("#bsod_message").text(message);
$("#bsod_source").text(source);
$("#bsod_lineno").text(lineno);
$("#bsod_colno").text(colno);
$("#bsod_error").text(error.stack);
$("#bsodmom").show();
};
function FormKeyDown(e) { function FormKeyDown(e) {
$("#bsodmom").hide();
var key = String.fromCharCode(e.which); var key = String.fromCharCode(e.which);
if (key === 'd') { if (key === 'd') {
alert("Your character's genome is " + ToDna(game.dna + "")); alert("Your character's genome is " + ToDna(game.dna + ""));
} }
// if (key === 'e') {
// simulateanerror();
// }
if (game.online) { if (game.online) {
if (key === 'b') { if (key === 'b') {
Brag('b', true); Brag('b', true);