aurbano / robinhood-node

:chart_with_upwards_trend: NodeJS client for Robinhood Trading :fire:
https://aurbano.github.io/robinhood-node
MIT License
694 stars 185 forks source link

RFC: Error reporting/promises refactor #105

Open aurbano opened 4 years ago

aurbano commented 4 years ago

As discussed in #80, authentication errors are async so they can't be handled properly at the moment.

A simple fix would be to modify callbacks to be callback(error, data) instead of the current callback(data).

We could be backwards compatible by doing callback(data, error), although this would go against standard library convention, so open to opinions on this as well.

Another option would be to refactor into using promises. Or even do both (optional callbacks, and promise returns): #86 offers a nice proposal for this by @evanshortiss I'm leaning towards this and will do some work for it in the following days unless anyone has a better idea

Open for comments! These changes will be released as v2 of Robinhood-node

mmahalwy commented 4 years ago

+1 for promise support