ware icon indicating copy to clipboard operation
ware copied to clipboard

Provide original arguments in callback in case of error

Open 486 opened this issue 10 years ago • 0 comments

function handler (err, obj) {
  if (err) handleWithContext(err, obj); // obj is undefined :(
}

middleware.run({ url: 'http://facebook.com' }, handler);

The callback should provide the arguments of .run() in case of an error so that I have a context. I.e. I want to cleanup some resources. Right now you can do this with a closure but not if the callback function is defined somewhere else.

I'd do a PR if you are OK with the API change.

486 avatar Mar 04 '15 15:03 486