Skip to content

Commit

Permalink
more refactoring in addVow
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jul 1, 2010
1 parent cca54cf commit f2eb7b2
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions lib/vows.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,16 @@ function addVow(vow) {
vows.tryEnd(batch);

}).addListener("error", function (err) {
var exception;

if (vow.callback.length >= 2) {
runTest([err]);
} else {
exception = { type: 'promise', error: err };
batch.errored ++;
output('errored', exception);
output('errored', { type: 'promise', error: err });
}
vows.tryEnd(batch);
});

function runTest(args) {
var exception, topic, status;
var topic, status;

if (vow.callback instanceof String) {
return output('pending');
Expand All @@ -96,14 +92,12 @@ function addVow(vow) {
// increment counters accordingly.
try {
vow.callback.apply(vow.binding || null, args);
output('honored', exception);
output('honored');
} catch (e) {
if (e.name && e.name.match(/AssertionError/)) {
exception = e.toString();
output('broken', exception);
output('broken', e.toString());
} else {
exception = e.stack || e.message || e.toString() || e;
output('errored', exception);
output('errored', e.stack || e.message || e.toString() || e);
}
}
}
Expand Down

0 comments on commit f2eb7b2

Please sign in to comment.