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
Expand Up @@ -129,12 +129,14 @@ this.Suite.prototype = new(function () {
} }


// Run the topic, passing the previous context topics // Run the topic, passing the previous context topics
// If topic `throw`s an exception, pass it down as a value
try { try {
topic = topic.apply(ctx.env, ctx.topics); 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) { catch (ex) {
ctx.env.callback(ex); ctx.env.callback(ex);
topic = undefined;
} }


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

0 comments on commit eb66421

Please sign in to comment.