Pass the error including stacktrace to error handlers and reporters
The global window error handler is used to handle errors thrown from within asynchronous functions and tests. The first parameter is the error; the fifth parameter is the full error object including the stacktrace. Searching for the first occurrence of an error instance to work with browsers, which may not comply with the HTML5 standard.
This commit is contained in:
@@ -7,7 +7,12 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
|
||||
var handler = handlers[handlers.length - 1];
|
||||
|
||||
if (handler) {
|
||||
handler.apply(null, Array.prototype.slice.call(arguments, 0));
|
||||
// Get error from (message, source, lineno, colno, error)
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
var error = args.find(function(arg) {
|
||||
return arg instanceof Error;
|
||||
});
|
||||
handler.apply(null, error ? [error] : args);
|
||||
} else {
|
||||
throw arguments[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user