Java Code Examples for com.android.volley.VolleyError#getMessage()
The following examples show how to use
com.android.volley.VolleyError#getMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LIApiError.java From socialmediasignup with MIT License | 5 votes |
public LIApiError(VolleyError volleyError) { super(volleyError.getMessage(), volleyError.fillInStackTrace()); this.volleyError = volleyError; if (volleyError.networkResponse != null) { httpStatusCode = volleyError.networkResponse.statusCode; try { apiErrorResponse = ApiErrorResponse.build(volleyError.networkResponse.data); errorType = ErrorType.apiErrorResponse; } catch (JSONException e) { errorType = ErrorType.other; } } }
Example 2
Source File: FiveCallsApi.java From android with MIT License | 5 votes |
private void onRequestError(VolleyError error) { for (CallRequestListener listener : mCallRequestListeners) { listener.onRequestError(); } if (error.getMessage() == null) { Log.d("Error", "no message"); } else { Log.d("Error", error.getMessage()); } }
Example 3
Source File: MsgUtils.java From openshop.io-android with MIT License | 5 votes |
public static void logErrorMessage(VolleyError error) { try { String errorData = new String(error.networkResponse.data); showMessage(null, new JSONObject(errorData)); } catch (Exception e) { if (error.getMessage() != null && !error.getMessage().isEmpty()) Timber.e(e, error.getMessage()); else Timber.e(e, "Cannot parse error message"); } }
Example 4
Source File: MsgUtils.java From openshop.io-android with MIT License | 5 votes |
public static void logAndShowErrorMessage(Activity activity, VolleyError error) { try { String errorData = new String(error.networkResponse.data); showMessage(activity, new JSONObject(errorData)); } catch (Exception e) { if (error.getMessage() != null && !error.getMessage().isEmpty()) Timber.e(e, error.getMessage()); else Timber.e(e, "Cannot parse error message"); showToast(activity, TOAST_TYPE_INTERNAL_ERROR, null, ToastLength.SHORT); } }
Example 5
Source File: ContentDownloadService.java From Hentoid with Apache License 2.0 | 5 votes |
private void onRequestError(VolleyError error, @NonNull ImageFile img, @NonNull DocumentFile dir, @NonNull String backupUrl) { // Try with the backup URL, if it exists and if the current image isn't a backup itself if (!img.isBackup() && !backupUrl.isEmpty()) { tryUsingBackupUrl(img, dir, backupUrl); return; } // If no backup, then process the error String statusCode = (error.networkResponse != null) ? error.networkResponse.statusCode + "" : "N/A"; String message = error.getMessage() + (img.isBackup() ? " (from backup URL)" : ""); String cause = ""; if (error instanceof TimeoutError) { cause = "Timeout"; } else if (error instanceof NoConnectionError) { cause = "No connection"; } else if (error instanceof AuthFailureError) { // 403's fall in this category cause = "Auth failure"; } else if (error instanceof ServerError) { // 404's fall in this category cause = "Server error"; } else if (error instanceof NetworkError) { cause = "Network error"; } else if (error instanceof ParseError) { cause = "Network parse error"; } Timber.w(error); updateImageStatusUri(img, false, ""); logErrorRecord(img.content.getTargetId(), ErrorType.NETWORKING, img.getUrl(), img.getName(), cause + "; HTTP statusCode=" + statusCode + "; message=" + message); }
Example 6
Source File: VolleyNetworkStack.java From wasp with Apache License 2.0 | 5 votes |
@Override public void onErrorResponse(VolleyError error) { Response.Builder builder = new Response.Builder().setUrl(url); String errorMessage = null; if (error != null) { builder.setNetworkTime(error.getNetworkTimeMs()); errorMessage = error.getMessage(); if (error.networkResponse != null) { NetworkResponse response = error.networkResponse; String body; try { body = new String( error.networkResponse.data, HttpHeaderParser.parseCharset(response.headers) ); } catch (UnsupportedEncodingException e) { body = "Unable to parse error body!!!!!"; } builder.setStatusCode(response.statusCode) .setHeaders(response.headers) .setBody(body) .setLength(response.data.length); } } waspCallback.onError(new WaspError(builder.build(), errorMessage)); }
Example 7
Source File: PinsFragment.java From Presentation with Apache License 2.0 | 5 votes |
@Override public void onErrorResponse(VolleyError error) { Message message = new Message(); message.what = SHOW_MESSAGE; message.obj = error.getMessage(); mUIChangedChangedHandler.sendMessage(message); }