Skip to content

Commit

Permalink
Set the return value to 'undefined' on an unexpected error (since we …
Browse files Browse the repository at this point in the history
…always use a callback); improve comments
  • Loading branch information
adamstallard committed Apr 2, 2013
1 parent d6604c3 commit eb66421
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/vows/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ this.Suite.prototype = new(function () {
}

// Run the topic, passing the previous context topics
// If topic `throw`s an exception, pass it down as a value
try {
topic = topic.apply(ctx.env, ctx.topics);
}
// If an unexpected error occurs in the topic, set the return
// value to 'undefined' and call back with the error
catch (ex) {
ctx.env.callback(ex);
topic = undefined;
}

if (typeof(topic) === 'undefined') { ctx._callback = true }
Expand Down

0 comments on commit eb66421

Please sign in to comment.