From eb6642140ce7c565bbc7e6182373e752688e149c Mon Sep 17 00:00:00 2001 From: adamstallard Date: Mon, 1 Apr 2013 18:34:47 -0700 Subject: [PATCH] Set the return value to 'undefined' on an unexpected error (since we always use a callback); improve comments --- lib/vows/suite.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/vows/suite.js b/lib/vows/suite.js index 26d7c65..400eecd 100644 --- a/lib/vows/suite.js +++ b/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 }