Permalink
Browse files

fix catch func reference

  • Loading branch information...
1 parent 5582f69 commit 70e10def7b9ebfa5fdb42fc2991ab11833bf52c2 @tasogarepg committed Apr 8, 2012
Showing with 3 additions and 1 deletion.
  1. +1 −1 lib/node-block.js
  2. +2 −0 test/node-block.test.js
View
@@ -21,7 +21,7 @@ function BlockInfo(funcs) {
this.cat = step;
this.cat.func = function(err, data) {
if (!err) return;
- func(err, data);
+ func.call(this, err, data);
this.errBaton = null;
};
} else if (func.name == 'fin') {
@@ -116,12 +116,14 @@ describe('node-block', function() {
it('throw exception', function(done) {
block(
function() {
+ this.data.d1 = 'a';
throw new Error('test');
},
function() {
assert(false);
},
function cat(err) {
+ assert.equal(this.data.d1, 'a');
assert.equal(err.message, 'test');
}
)(done);

0 comments on commit 70e10de

Please sign in to comment.