Last active
February 20, 2020 23:33
-
-
Save willwalker753/22035ee97f2bfeb4d6eb001980bb8e4b to your computer and use it in GitHub Desktop.
Error alert drill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
try { | |
doAllTheThings(); | |
} | |
catch(FatalException) { | |
console.log('Caught FatalException '+FatalException); | |
reportError(FatalException); | |
} | |
} | |
function doAllTheThings() { | |
throw { | |
message: "Everything's ruined", | |
name: "FatalException", | |
toString: function() { | |
return `${this.name}: ${this.message}`; | |
} | |
} | |
} | |
function reportError(e) { | |
$('.js-error-report').text(`Uh oh, something went wrong! Here's what we know: ${e.message}`); | |
} | |
$(main); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment