global-catch-error.js
375 Bytes
import Vue from 'vue'
/**
* Global catch handler
*/
window.onerror = function(message, source, line, column, error) {
console.log('error:', message)
}
const errorHandler = (error, vm) => {
console.log(`Error: ${error.toString()}\nInfo: ${info}`)
}
Vue.config.errorHandler = errorHandler
Vue.prototype.$throw = function(error) {
return errorHandler(error, this)
}