Skip to content
Browse files

Set the return value to 'undefined' on an unexpected error (since we …

…always use a callback); improve comments
  • Loading branch information...
1 parent d6604c3 commit eb6642140ce7c565bbc7e6182373e752688e149c @adamstallard committed
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/vows/suite.js
View
4 lib/vows/suite.js
@@ -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 }

0 comments on commit eb66421

Please sign in to comment.
Something went wrong with that request. Please try again.