Global Error Handling in Vue.js
September 26, 2019•60 words
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();
// ...
});