log js errors

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

View File

@ -13,6 +13,8 @@ import item.api
import user.api
import update
import logging
logger = logging.getLogger(__name__)
def selectFolder(data):
'''
@ -88,3 +90,14 @@ def quit(data):
state.main.stop()
return {}
actions.register(quit, cache=False)
def logError(data):
'''
takes {
}
returns {
}
'''
#logger.debug('frontend error %s', data)
return {}
actions.register(logError, cache=False)

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'),