I am using the Retrofit library to do REST calls to a service I am using.
If I make an API call to my service and have a failure, the service returns a bit of JSON
@LukaCiko answer not working now for me in retrofit 1.6.1. Here like I'm doing it now:
@Override
public void failure(RetrofitError retrofitError) {
String json = new String(((TypedByteArray)retrofitError.getResponse().getBody()).getBytes());
//own logic for example
ExampleHandlerError error = new Gson().fromJson(json, ExampleHandlerError.class);
}