samuraitruong / coingecko-api-v3

The nodejs api library for accessing coingecko api v3 , develop with typescript
https://samuraitruong.github.io/coingecko-api-v3/
MIT License
54 stars 30 forks source link

feat: should fail on not 2xx status code #33

Closed ThallesP closed 1 year ago

ThallesP commented 1 year ago

Hey! I'm using this library to fetch market coins, but sometimes the coin gecko API fails with 503.

Instead of trying to return something, throwing an error would be a good option as the developer can handle that.

I've some questions now, there's the auto-retry option, when it fails, should it retry? If yes, should it retry only one time? Also, would be a good option to display the returned data? something like this:

throw new Error(`got invalid code. data: ${res.data}`)
samuraitruong commented 1 year ago

Thanks @ThallesP t merged now