Also log unhandled errors to the console

This commit is contained in:
Kovid Goyal 2016-03-26 12:57:58 +05:30
parent 5372b390d7
commit 887c92ad6f

View File

@ -66,6 +66,7 @@ class Boss:
document.title = self.read_ui.current_metadata.title document.title = self.read_ui.current_metadata.title
def onerror(self, msg, script_url, line_number, column_number, error_object): def onerror(self, msg, script_url, line_number, column_number, error_object):
console.log(error_object)
try: try:
fname = str.rpartition(script_url, '/')[-1] or script_url fname = str.rpartition(script_url, '/')[-1] or script_url
msg = msg + '<br><span style="font-size:smaller">' + str.format('Error at {}:{}:{}', fname, line_number, column_number or '') + '</span>' msg = msg + '<br><span style="font-size:smaller">' + str.format('Error at {}:{}:{}', fname, line_number, column_number or '') + '</span>'
@ -75,7 +76,7 @@ class Boss:
error_dialog(_('Unhandled error'), msg, details) error_dialog(_('Unhandled error'), msg, details)
return True return True
except: except:
console.error('There was an error in the unhandled exception handler') console.log('There was an error in the unhandled exception handler')
def onpopstate(self, ev): def onpopstate(self, ev):
data = parse_url_params() data = parse_url_params()