Skip to content

Library does not always pass Errors to callbacks #11

@dlopuch

Description

@dlopuch

It's a node-ism that the first parameter in a callback is an error, but it's also a nodeism that the first parameter is an instanceof Error. This allows user callback code to assume a standard API -- things like error.stack, error.message -- for actions like logging, analytics, etc.

https://github.com/robrighter/node-recurly/blob/master/lib/client.js#L86 is one instance where node-recurly does not pass Errors to the user callback for the error parameter, breaking any user code that assumes a standard Error api.

_wrap_response() can still set the .statusCode and .headers on the Error object, but it should return an instanceof Error if it's wrapping an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions