window.onerror: log stack to server if available
Firefox >= 31 and Chrome >= ~August 2013 pass the Error object as the 5th parameter to window.onerror. https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror https://code.google.com/p/chromium/issues/detail?id=147127
This commit is contained in:
parent
8b0459592c
commit
0e4c49729b
1 changed files with 4 additions and 2 deletions
|
@ -21,13 +21,15 @@ appPanel
|
|||
|
||||
(function() {
|
||||
|
||||
window.onerror = function(error, url, line) {
|
||||
window.onerror = function(error, url, line, column, errorObj) {
|
||||
if (error == 'TypeError: Attempted to assign to readonly property.') {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
var stack = (errorObj && errorObj.stack) || "(no stack trace available)";
|
||||
|
||||
!isMSIE && !/^resource:/.test(url) && pandora.api.logError({
|
||||
text: error,
|
||||
text: error + "\n\n" + stack,
|
||||
url: document.location.pathname + ' at ' + url,
|
||||
line: line
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue