Take error object of onerror() to get correct traceback.
This commit is contained in:
parent
73f6cc6389
commit
28b3ee1d65
1 changed files with 11 additions and 3 deletions
|
@ -182,10 +182,18 @@ class _trackSingleton
|
|||
return stack.splice(stack[0] == 'Error' ? 2 : 1)
|
||||
}
|
||||
window.onerrorOld = window.onerror
|
||||
window.onerror = function(errorMsg, url, lineNumber) {
|
||||
console.error(errorMsg + " - in " + url + ", line " + lineNumber + "\n" + window.getStackTrace().join("\n"))
|
||||
window.onerror = function(errorMsg, url, lineNumber, column, errorObj) {
|
||||
var stack = ''
|
||||
if (errorObj !== undefined && errorObj.stack) {
|
||||
stack = "\n" + errorObj.stack
|
||||
}
|
||||
App.Track.log(
|
||||
'console.error',
|
||||
'error',
|
||||
errorMsg + " - in " + url + ", line " + lineNumber + stack
|
||||
)
|
||||
if (window.onerrorOld) {
|
||||
window.onerrorOld(errorMsg, url, lineNumber)
|
||||
window.onerrorOld(errorMsg, url, lineNumber, column, errorObj)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue