coinapi-sdk icon indicating copy to clipboard operation
coinapi-sdk copied to clipboard

Error handling in Ruby SDK

Open iajrz opened this issue 7 years ago • 2 comments

When calling some methods from the SDK, like Client#exchange_rates_get_specific_rate, there are some edge cases - in particular, the test API Key has no access to the "specific exchange rate" endpoint, so it gets a 403.

But the method still tries to parse the date before returning the object, which results in an obscure "nil can't be parsed" sort of error.

Many such details exist.

Does the SDK intend to pass the message object with the error?

iajrz avatar Jan 17 '18 19:01 iajrz

I think SDK should throw an exception in this case with error message received from the API, such an exception object will unwind a call stack to the user code or beyond.

Can you confirm that such behavior don't exists in the master branch?

Svisstack avatar Jan 19 '18 17:01 Svisstack

This behavior doesn't exist. Nothing is raised in the Ruby code. I don't see it in Python or C# code either.

I see the Java SDK has error code handling and surfaces it to the coder. Perhaps other implementations should follow suit.

iajrz avatar Jan 19 '18 19:01 iajrz