Skip to content

Instantly share code, notes, and snippets.

@niftynei
Created December 17, 2015 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niftynei/5b247fffec6f5b765716 to your computer and use it in GitHub Desktop.
Save niftynei/5b247fffec6f5b765716 to your computer and use it in GitHub Desktop.
public <ReturnType> EoNetworkRequest<ReturnType> makeRequest(EoNetworkRequest<ReturnType> request) {
try {
retrofit.Response<ReturnType> response = request.makeRequest();
if (response.isSuccess()) {
return request;
} else {
// todo: parse the error body into some sort of usable structure. or something??
}
} catch (IOException e) { // network error
request.setNetworkError(e);
} catch (Exception ex) {
// unexpected error! probably best practice to throw.
// throw ex;
EoLog.e(TAG, ex);
}
return request;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment