I am creating a webapp and trying to capture all the errors thrown anywhere in vue.js webapp.
I watched errorHandler , but it only fixes the error during rendering or observers, as indicated:
Assign a handler for unverified errors during component and observer rendering. The handler is called with an error and a Vue instance.
Having received the answer from this question , I wrote 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) })
Both are called above, but I don't see any details about the errors. in all cases, I get errorMessage
as a script error
What could be the best way to get information about all errors and send it to some centralized place, such as sentry .
source share