Permalink
Browse files

Allow arguments to flow through to callbacks in error conditions.

https://gist.github.com/1152218  Topic callbacks should receive all
arguments passed in error situations.  Currently only the first argument
is passed to the callback function regardless of how many arguments are
sent.
  • Loading branch information...
1 parent 3b9acac commit 0108f1f7a61f63c1b389bc4a3116f4fbcb798b85 @bentaber bentaber committed with indexzero Aug 17, 2011
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/vows.js
  2. +1 −1 lib/vows/context.js
  3. +1 −1 lib/vows/extras.js
View
@@ -73,7 +73,7 @@ function addVow(vow) {
}).on("error", function (err) {
if (vow.callback.length >= 2 || !batch.suite.options.error) {
- runTest([err], this.ctx);
+ runTest(arguments, this.ctx);
} else {
output('errored', { type: 'promise', error: err.stack || err.message || JSON.stringify(err) });
}
View
@@ -28,7 +28,7 @@ this.Context = function (vow, ctx, env) {
if (typeof(e) === 'boolean' && args.length === 0) {
that.emitter.emit.call(that.emitter, 'success', e);
} else {
- if (e) { that.emitter.emit.call(that.emitter, 'error', e) }
+ if (e) { that.emitter.emit.apply(that.emitter, ['error', e].concat(args)) }
else { that.emitter.emit.apply(that.emitter, ['success'].concat(args)) }
}
};
View
@@ -13,7 +13,7 @@ this.prepare = function (obj, targets) {
args.push(function (err /* [, data] */) {
var args = Array.prototype.slice.call(arguments, 1);
- if (err) { ee.emit('error', err) }
+ if (err) { ee.emit.apply(ee, ['error', err].concat(args)) }
else { ee.emit.apply(ee, ['success'].concat(args)) }
});
fun.apply(obj, args);

0 comments on commit 0108f1f

Please sign in to comment.