goshippo / shippo-node-client

Shipping API Node.js library (USPS, FedEx, UPS and more)
https://goshippo.com/docs
MIT License
136 stars 54 forks source link

.catch() does not work #38

Closed lrettig closed 7 years ago

lrettig commented 7 years ago

Hello,

This package appears to be using a nonstandard promise implementation library called when. In particular, when I try to chain the promises returned by these functions with native JS promises, I get errors since they do not support the catch method (and probably others as well). Would it make sense to move this library to a more standard promises implementation--native JS promises with a polyfill, or bluebird?

Thank you.

mootrichard commented 7 years ago

Yes, currently the wrapper doesn't support regular Promises for every endpoint. You can still provide 2 functions to the .then(). The first function would be the resolve path and the second would handle a rejection.

I would agree that moving the library to support the more standard promise structure seen in bluebird and most browsers. We'll definitely look into upgrading the library to handle that.