SHARE
TWEET

Untitled

a guest Oct 21st, 2019 74 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(e);
  7.     reportError(e);
  8.   }
  9. }
  10.  
  11. function doAllTheThings() {
  12.   throw {
  13.     message: "Everything's ruined",
  14.     name: "FatalException",
  15.     toString: function() {
  16.       return `${this.name}: ${this.message}`;
  17.     }
  18.   }
  19. }
  20.  
  21. function reportError(e) {
  22.   $('.js-error-report').text(`Uh oh, something went wrong! Here's what we know: ${e.message}`);
  23. }
  24.  
  25. $(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