mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 887582 - improve logException. r=yzen
This commit is contained in:
parent
38d43986be
commit
feb20f50fb
@ -57,8 +57,7 @@ this.EventManager.prototype = {
|
||||
this.present(Presentation.tabStateChanged(null, 'newtab'));
|
||||
|
||||
} catch (x) {
|
||||
Logger.error('Failed to start EventManager');
|
||||
Logger.logException(x);
|
||||
Logger.logException(x, 'Failed to start EventManager');
|
||||
}
|
||||
},
|
||||
|
||||
@ -117,8 +116,7 @@ this.EventManager.prototype = {
|
||||
}
|
||||
}
|
||||
} catch (x) {
|
||||
Logger.error('Error handling DOM event');
|
||||
Logger.logException(x);
|
||||
Logger.logException(x, 'Error handling DOM event');
|
||||
}
|
||||
},
|
||||
|
||||
@ -421,8 +419,7 @@ const AccessibilityEventObserver = {
|
||||
try {
|
||||
eventManager.handleAccEvent(event);
|
||||
} catch (x) {
|
||||
Logger.error('Error handing accessible event');
|
||||
Logger.logException(x);
|
||||
Logger.logException(x, 'Error handing accessible event');
|
||||
} finally {
|
||||
return;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ VisualPresenter.prototype = {
|
||||
}
|
||||
};
|
||||
} catch (e) {
|
||||
Logger.error('Failed to get bounds: ' + e);
|
||||
Logger.logException(e, 'Failed to get bounds');
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
@ -271,12 +271,27 @@ this.Logger = {
|
||||
this, [this.ERROR].concat(Array.prototype.slice.call(arguments)));
|
||||
},
|
||||
|
||||
logException: function logException(aException) {
|
||||
logException: function logException(
|
||||
aException, aErrorMessage = 'An exception has occured') {
|
||||
try {
|
||||
let args = [aException.message];
|
||||
args.push.apply(args, aException.stack ? ['\n', aException.stack] :
|
||||
['(' + aException.fileName + ':' + aException.lineNumber + ')']);
|
||||
this.error.apply(this, args);
|
||||
let stackMessage = '';
|
||||
if (aException.stack) {
|
||||
stackMessage = ' ' + aException.stack.replace(/\n/g, '\n ');
|
||||
} else if (aException.location) {
|
||||
let frame = aException.location;
|
||||
let stackLines = [];
|
||||
while (frame && frame.lineNumber) {
|
||||
stackLines.push(
|
||||
' ' + frame.name + '@' + frame.filename + ':' + frame.lineNumber);
|
||||
frame = frame.caller;
|
||||
}
|
||||
stackMessage = stackLines.join('\n');
|
||||
} else {
|
||||
stackMessage = '(' + aException.fileName + ':' + aException.lineNumber + ')';
|
||||
}
|
||||
this.error(aErrorMessage + ':\n ' +
|
||||
aException.message + '\n' +
|
||||
stackMessage);
|
||||
} catch (x) {
|
||||
this.error(x);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ function virtualCursorControl(aMessage) {
|
||||
sendAsyncMessage('AccessFu:VirtualCursor', aMessage.json);
|
||||
}
|
||||
} catch (x) {
|
||||
Logger.error(x);
|
||||
Logger.logException(x, 'Failed to move virtual cursor');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user