straw-hat-labs / bittrex

Bittrex Client for Elixir
https://hex.pm/packages/bittrex
MIT License
11 stars 6 forks source link

Not all response codes are handled #25

Closed kwrooijen closed 6 years ago

kwrooijen commented 6 years ago

Hi,

It seems that when processing a response, not all status codes are covered. Only code 200 is handled.

https://github.com/straw-hat-team/bittrex/blob/e296e3f6602926d9eddd303ac474343838199634/lib/bittrex/client.ex#L34-L38

The problem is that if a response is not successful (not code 2xx) then it will still return {:ok, response}. The question is: should the library API wrap a non-successful response as {:ok, decoded} or {:error, decoded} ?

I came across this issue because I got a 503 response (service unavailable).

yordis commented 6 years ago

@kwrooijen sorry for the delay for some reason Github didn't send me any notification. For the future, please tag me on it.

You are right, I forgot to handle other response codes ... working on it.