krystianity / node-bitstamp

bitstamp REST and WS API Node.js client :dollar:
MIT License
59 stars 41 forks source link

API respose error lost in catch() #25

Closed tiagosiebler closed 5 years ago

tiagosiebler commented 5 years ago

I'm triggering an API response error by having more than 8 decimals in my marketBuy call, and I noticed the catch() call in the promise returns unusable info: screenshot 2018-12-03 at 13 24 33

Debugging the stack trace leads me to this: screenshot 2018-12-03 at 13 22 00

The information is there, can't we just reject(body.reason)?

The new Error seems redundant, and prevents the info being passed back to the caller, meaning the root cause can't be pinned/logged without debugging this module.