Skip to content

Provide original arguments in callback in case of error #23

@486

Description

@486
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions