node-recurly
node-recurly copied to clipboard
Library does not always pass Errors to callbacks
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.