Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
114
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(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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement