use of com.github.natanbc.reliqua.request.RequestException in project Ree6 by Ree6-Applications.
the class RequestUtils method handleError.
public static <T> void handleError(RequestContext<T> context) {
Response response = context.getResponse();
ResponseBody body = response.body();
if (body == null) {
context.getErrorConsumer().accept(new RequestException("Unexpected status code " + response.code() + " (No body)", context.getCallStack()));
return;
}
JSONObject json = null;
try {
json = toJSONObject(response);
} catch (JSONException ignored) {
}
handleErrorCode(json, context);
}
Aggregations