dwf/rva: exception handling should now work in most cases.
This commit is contained in:
@@ -133,14 +133,22 @@ var queuedFunction = function(func, timeout, spec) {
|
||||
next: function () {
|
||||
spec.finish(); // default value is to be done after one function
|
||||
},
|
||||
safeExecute: function () {
|
||||
try {
|
||||
that.func.apply(spec);
|
||||
}
|
||||
catch (e) {
|
||||
spec.results.push({passed:false, message: Jasmine.Util.formatException(e)});
|
||||
}
|
||||
},
|
||||
execute: function () {
|
||||
if (timeout > 0) {
|
||||
setTimeout(function () {
|
||||
that.func.apply(spec);
|
||||
that.safeExecute();
|
||||
that.next();
|
||||
}, timeout);
|
||||
} else {
|
||||
that.func.apply(spec);
|
||||
that.safeExecute();
|
||||
that.next();
|
||||
}
|
||||
}
|
||||
@@ -252,22 +260,9 @@ var it = function (description, func) {
|
||||
that.finished = true;
|
||||
},
|
||||
|
||||
safeExecute: function(queuedFunc) {
|
||||
try {
|
||||
queuedFunc.execute();
|
||||
}
|
||||
catch (e) {
|
||||
that.results.push({
|
||||
passed: false,
|
||||
message: Jasmine.Util.formatException(e)
|
||||
});
|
||||
queuedFunc.next();
|
||||
}
|
||||
},
|
||||
|
||||
execute: function () {
|
||||
if (that.queue[0]) {
|
||||
that.safeExecute(that.queue[0])
|
||||
that.queue[0].execute();
|
||||
}
|
||||
else {
|
||||
that.finish();
|
||||
@@ -282,7 +277,7 @@ var it = function (description, func) {
|
||||
if (that.queue.length > 1) {
|
||||
var previousFunction = that.queue[that.queue.length - 2];
|
||||
previousFunction.next = function () {
|
||||
that.safeExecute(currentFunction);
|
||||
currentFunction.execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,32 +390,32 @@ Jasmine.Reporters.reporter = function (callbacks) {
|
||||
|
||||
Jasmine.Util = {
|
||||
formatException: function(e) {
|
||||
// if (typeof e === 'String') {
|
||||
// return e;
|
||||
// }
|
||||
var lineNumber;
|
||||
if (e.line) {
|
||||
lineNumber = e.line;
|
||||
}
|
||||
else if (e.lineNumber) {
|
||||
lineNumber = e.lineNumber;
|
||||
}
|
||||
// if (typeof e === 'String') {
|
||||
// return e;
|
||||
// }
|
||||
var lineNumber;
|
||||
if (e.line) {
|
||||
lineNumber = e.line;
|
||||
}
|
||||
else if (e.lineNumber) {
|
||||
lineNumber = e.lineNumber;
|
||||
}
|
||||
|
||||
var file;
|
||||
var file;
|
||||
|
||||
if (e.sourceURL) {
|
||||
file = e.sourceURL;
|
||||
}
|
||||
else if (e.fileName) {
|
||||
file = e.fileName;
|
||||
}
|
||||
if (e.sourceURL) {
|
||||
file = e.sourceURL;
|
||||
}
|
||||
else if (e.fileName) {
|
||||
file = e.fileName;
|
||||
}
|
||||
|
||||
var message = e.name + ': ' + e.message;
|
||||
if (file && lineNumber) {
|
||||
message += ' in ' + file +' (line ' + lineNumber + ')';
|
||||
}
|
||||
var message = e.name + ': ' + e.message;
|
||||
if (file && lineNumber) {
|
||||
message += ' in ' + file + ' (line ' + lineNumber + ')';
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user