Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload API throws RuntimeException #44

Open
JulienArzul opened this issue May 2, 2016 · 2 comments
Open

Upload API throws RuntimeException #44

JulienArzul opened this issue May 2, 2016 · 2 comments

Comments

@JulienArzul
Copy link

Hello,

You should provide an easy way to handle upload errors in your SDK.

The method signature suggests that you will be throwing an IOException but looking at the source code, we can see that you're actually throwing RuntimeException in several cases ! These cases should be handled differently in the SDK so that the caller can identify them : they are definitely not a reason to throw a RuntimeException.

At the minimum, you should throw a IOException as specified by the upload signature.
Alternatively, you could think about a nicer error handling system, either with a custom Exception or with a specific Map returned (whose values should be documented !).

@tocker
Copy link
Contributor

tocker commented May 18, 2016

Hi @JulienArzul,
You may have a point here however we cannot change the exception to IOException without changing the method signature and thus breaking backward compatibility.
We'll revisit this issue on the next major version release.

@tocker tocker self-assigned this May 18, 2016
@rocketraman
Copy link

+1

You may have a point here however we cannot change the exception to IOException without changing the method signature and thus breaking backward compatibility.

Actually you can change it without changing the signature -- the method already declares throws IOException. It just doesn't.

However, I'd note @JulienArzul's other comment: better to use a custom exception type that allows extracting the status code and a Map that contains the body of the response, or some structured type with the same values.

@tocker tocker removed their assignment Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants