Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 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. 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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement