Breaking change: use addEventListener rather than setting window.onerror
* Generally simplifies error handling in browsers * Makes Jasmine's own integration tests easier to debug * Stack traces will be provided for more global errors * ... but less error information will be provided in some browsers if the error comes from a file:// URL (use `npx serve` or similar instead) * Jasmine will no longer override existing onerror handlers in browsers * Setting window.onerror will no longer override Jasmine's global error handling (use jasmine.spyOnGlobalErrors instead)
This commit is contained in:
@@ -66,11 +66,8 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
}
|
||||
|
||||
QueueRunner.prototype.execute = function() {
|
||||
this.handleFinalError = (message, source, lineno, colno, error) => {
|
||||
// Older browsers would send the error as the first parameter. HTML5
|
||||
// specifies the the five parameters above. The error instance should
|
||||
// be preffered, otherwise the call stack would get lost.
|
||||
this.onException(error || message);
|
||||
this.handleFinalError = error => {
|
||||
this.onException(error);
|
||||
};
|
||||
this.globalErrors.pushListener(this.handleFinalError);
|
||||
this.run(0);
|
||||
|
||||
Reference in New Issue
Block a user