log js errors

This commit is contained in:
j 2016-02-23 13:45:37 +05:30
commit 695deb0947
2 changed files with 27 additions and 0 deletions

View file

@ -1,6 +1,20 @@
'use strict';
(function() {
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)";
!/^resource:/.test(url) && oml.api.logError({
text: error + "\n\n" + stack,
url: document.location.pathname + ' at ' + url,
line: line
});
} catch(e) {}
};
var animationInterval,
enableDebugMode = getLocalStorage('oml.enableDebugMode'),