Skip to content
Browse files

[refactoring] Passing variable to error handler

  • Loading branch information...
1 parent 48b6233 commit ac056b56d09887ed3497e4456d96e460f7259321 @ben-lin ben-lin committed Dec 31, 2012
Showing with 6 additions and 5 deletions.
  1. +3 −2 lib/flow.js
  2. +3 −3 test/flow.js
View
5 lib/flow.js
@@ -129,13 +129,14 @@ Flow.prototype = {
*/
_run_series : function ( args ){
if( args.length && args[ 0 ] instanceof Error ){
- return this._error( args[ 0 ]);
+ return this._error.apply( this, args );
}
try{
this._series.shift().apply( this, args );
}catch( err ){
- this._error( err );
+ args.unshift( err );
+ this._error.apply( this, args );
}
},
View
6 test/flow.js
@@ -361,7 +361,7 @@ module.exports = {
x.should.equal( 7 );
y.should.equal( 6 );
z.should.equal( 7 );
- next( new Error( 'Error found' ));
+ next( new Error( 'Error found' ), 11, 22, 89 );
}, 200 );
}, 7 ).
@@ -374,8 +374,8 @@ module.exports = {
}, 100 );
}, 9, 10, 55 ).
- error( function ( err ){
- console.log( 'error handeling', err );
+ error( function ( err, x ){
+ console.log( 'error handeling', arguments );
}).
end( function ( x ){

0 comments on commit ac056b5

Please sign in to comment.
Something went wrong with that request. Please try again.