Guest User

Untitled

a guest
Dec 12th, 2017
89
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.  
  3. try {
  4. doAllTheThings();
  5. }
  6. catch(e){
  7. return reportError(e);
  8. console.error(e);
  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