Wrap more data into RetrofitError
jonnyzzz opened this issue · 2 comments
jonnyzzz commented
Currently it reports errors like
Caused by: retrofit.RetrofitError: 404 Not Found
at retrofit.RetrofitError.httpError(RetrofitError.java:40)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:388)
at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
at com.sun.proxy.$Proxy0.artifactChildren(Unknown Source)
at org.jetbrains.teamcity.rest.BuildImpl.getArtifacts(implementation.kt:231)
at com.jetbrains.toolbox.feedgen.Feedgen_dsl_nightlyKt.lookupTeamCityArtifact(feedgen-dsl-nightly.kt:141)
... 30 more
But RetrofitError itself contains all information on what went wrong on what URL.
Let's wrap it with out exception type that have a better message with all details.
jonnyzzz commented
Can easily be implemented via
RestAdapter.Builder()
...
.setErrorHandler(ErrorHandler { throw Error("Failed to connect to ${it.url}. ${it.message}", it) })
Let me know if you know any meaningful usages of the RetrofitError exception outside of the library
shalupov commented
PRs are welcome :) Actually, this library is built by Demand Driven Development