As I develop a web application, my goal is to effectively capture any errors that may occur throughout the entire Vue.js web app.
Although I investigated the errorHandler, I discovered that it only catches errors during rendering or watching processes. The documentation specifies:
Assign a handler for uncaught errors during component render and watchers. The handler gets called with the error and the Vue instance.
With inspiration from this related question, I implemented the following code:
window.onerror = function (errorMsg, url, lineNumber, column, errorObj) {
console.log('Inside window.onerror')
console.log(errorMsg, ' ', url, ' ', lineNumber, ' ', column, ' ', errorObj)
return false
}
window.addEventListener('error', function (e) {
console.log('Inside error Listener', e.message)
})
Although both functions are triggered, I found that I'm only receiving the error message as 'script error' in all cases.
Is there a more effective way to obtain detailed error information and securely transmit it to a centralized location such as Sentry?