Skip to content

Instantly share code, notes, and snippets.

@willwalker753
Last active February 20, 2020 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willwalker753/22035ee97f2bfeb4d6eb001980bb8e4b to your computer and use it in GitHub Desktop.
Save willwalker753/22035ee97f2bfeb4d6eb001980bb8e4b to your computer and use it in GitHub Desktop.
Error alert drill
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