Skip to content

Commit

Permalink
[api fix] When topic throws, treat exception as a return value
Browse files Browse the repository at this point in the history
Fixes #65.
  • Loading branch information
mmalecki committed Dec 23, 2011
1 parent a480a5f commit 6f84e3b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/vows/suite.js
Expand Up @@ -129,7 +129,13 @@ this.Suite.prototype = new(function () {
}

// Run the topic, passing the previous context topics
topic = topic.apply(ctx.env, ctx.topics);
// If topic `throw`s an exception, pass it down as a value
try {
topic = topic.apply(ctx.env, ctx.topics);
}
catch (ex) {
topic = ex;
}

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

1 comment on commit 6f84e3b

@Filirom1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature causes two regressions : #202 and #203

Please sign in to comment.