Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library does not always pass Errors to callbacks #11

Open
dlopuch opened this issue Dec 1, 2014 · 0 comments
Open

Library does not always pass Errors to callbacks #11

dlopuch opened this issue Dec 1, 2014 · 0 comments

Comments

@dlopuch
Copy link

dlopuch commented Dec 1, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant