Skip to content

Commit ac056b5

Browse files
committed
[refactoring] Passing variable to error handler
1 parent 48b6233 commit ac056b5

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

lib/flow.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,14 @@ Flow.prototype = {
129129
*/
130130
_run_series : function ( args ){
131131
if( args.length && args[ 0 ] instanceof Error ){
132-
return this._error( args[ 0 ]);
132+
return this._error.apply( this, args );
133133
}
134134

135135
try{
136136
this._series.shift().apply( this, args );
137137
}catch( err ){
138-
this._error( err );
138+
args.unshift( err );
139+
this._error.apply( this, args );
139140
}
140141
},
141142

test/flow.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ module.exports = {
361361
x.should.equal( 7 );
362362
y.should.equal( 6 );
363363
z.should.equal( 7 );
364-
next( new Error( 'Error found' ));
364+
next( new Error( 'Error found' ), 11, 22, 89 );
365365
}, 200 );
366366
}, 7 ).
367367

@@ -374,8 +374,8 @@ module.exports = {
374374
}, 100 );
375375
}, 9, 10, 55 ).
376376

377-
error( function ( err ){
378-
console.log( 'error handeling', err );
377+
error( function ( err, x ){
378+
console.log( 'error handeling', arguments );
379379
}).
380380

381381
end( function ( x ){

0 commit comments

Comments
 (0)