This is what I did by putting it into the debugger. Note: this is for actually getting it inside the error callback, not for success callback.
You will see that the success type is found by calling retrofitError.getSuccessType() and returns an object of type Type
Then you can call retrofitError.getBodyAs(YourType.class) , which is all I need to do, because for me it is always the class that I expect.
Here is the answer with one liner:
retrofitError.getBodyAs(retrofitError.getSuccessType())
Now, I have to point out that I donβt need to do anything similar with respect to the success callback, because it already works magically.
styler1972 Mar 23 '16 at 19:21 2016-03-23 ββ19:21
source share