Skip to content

Commit eb66421

Browse files
committed
Set the return value to 'undefined' on an unexpected error (since we always use a callback); improve comments
1 parent d6604c3 commit eb66421

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/vows/suite.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ this.Suite.prototype = new(function () {
129129
}
130130

131131
// Run the topic, passing the previous context topics
132-
// If topic `throw`s an exception, pass it down as a value
133132
try {
134133
topic = topic.apply(ctx.env, ctx.topics);
135134
}
135+
// If an unexpected error occurs in the topic, set the return
136+
// value to 'undefined' and call back with the error
136137
catch (ex) {
137138
ctx.env.callback(ex);
139+
topic = undefined;
138140
}
139141

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

0 commit comments

Comments
 (0)