Note: The Listed platform will permanently shut down December 31, 2026. Your data published on Listed will still be available in your personal Standard Notes account. Learn more

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