Global Error Handling in Vue.js

Handle errors from Vue components

 Vue.config.errorHandler = function(err: Error, vm: Vue, info: string) {
      // ...
    };

Handle javascript errors

 window.onerror = function(msg: any, url: any, line: any, col: any, error: any){
      // ...
    };

Handle errors from rejected promises as these are not caught by window.onerror

 window.addEventListener("unhandledrejection", function(event: any){
      event.preventDefault();
      // ...
    });

More from David Strain
All posts