diff --git a/src/core/GlobalErrors.js b/src/core/GlobalErrors.js index 2c58e684..e8430c1e 100644 --- a/src/core/GlobalErrors.js +++ b/src/core/GlobalErrors.js @@ -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]; }