SHARE
TWEET

Untitled

a guest Jul 21st, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function main() {
  2.   try {
  3.     doAllTheThings();
  4.   }
  5.   catch(e) {
  6.     console.error(reportError(e));
  7.   }
  8. }
  9.  
  10. function doAllTheThings() {
  11.   throw {
  12.     message: "Everything's ruined",
  13.     name: "FatalException",
  14.     toString: function() {
  15.       return `${this.name}: ${this.message}`;
  16.     }
  17.   }
  18. }
  19.  
  20. function reportError(e) {
  21.   $('.js-error-report').text(`Uh oh, something went wrong! Here's what we know: ${e.message}`);
  22. }
  23.  
  24. $(main);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top