From 464e71bdbf599135d6bd98dc931d022e5862f3de Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Thu, 23 Apr 2015 16:18:40 +0100 Subject: [PATCH 1/2] 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 --- static/js/pandora.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/pandora.js b/static/js/pandora.js index 496c5f7..80c29c3 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -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 }); -- 2.1.0