Guest User

Untitled

a guest
Jun 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. function main() {
  2. try {
  3. doAllTheThings();
  4. }
  5. catch(e) {
  6. console.error(e);
  7. reportError(e);
  8. }
  9. }
  10.  
  11.  
  12. function doAllTheThings() {
  13. throw {
  14. message: "Everything's ruined",
  15. name: "FatalException",
  16. toString: function() {
  17. return `${this.name}: ${this.message}`;
  18. }
  19. }
  20. }
  21.  
  22. function reportError(e) {
  23. $('.js-error-report').text(`Uh oh, something went wrong! Here's what we know: ${e.message}`);
  24. }
  25.  
  26. $(main);
Add Comment
Please, Sign In to add comment