Permalink
Browse files

[api fix] When topic `throw`s, treat exception as a return value

Fixes #65.
  • Loading branch information...
1 parent a480a5f commit 6f84e3b535239e8b36adfc656510b99b37d78859 @mmalecki mmalecki committed Dec 23, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/vows/suite.js
View
@@ -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 }
}

1 comment on commit 6f84e3b

Contributor

Filirom1 commented on 6f84e3b Mar 30, 2012

This feature causes two regressions : #202 and #203

Please sign in to comment.