@Override public void onCompleted(GraphResponse response) { FacebookRequestError error = response.getError(); if (error != null) { Logger.logError(RequestAction.class, "Failed to get what you have requested", error.getException()); if (mSingleEmitter != null) { mSingleEmitter.onError(error.getException()); } } else { if (response.getRawResponse() == null) { Logger.logError(RequestAction.class, "The response GraphObject " + "has null value. Response=" + response.toString(), null); mSingleEmitter.onError(new FacebookGraphResponseException(response, "The response has null value")); } else { if (mSingleEmitter != null) { mSingleEmitter.onSuccess(response); } } } }
static void invokeOnErrorCallback( FacebookCallback<Sharer.Result> callback, GraphResponse response, String message) { logShareResult(AnalyticsEvents.PARAMETER_SHARE_OUTCOME_ERROR, message); if (callback != null) { callback.onError(new FacebookGraphResponseException(response, message)); } }
protected void executeGraphRequestSynchronously(Bundle parameters) { GraphRequest request = new GraphRequest( uploadContext.accessToken, String.format(Locale.ROOT, "%s/videos", uploadContext.graphNode), parameters, HttpMethod.POST, null); GraphResponse response = request.executeAndWait(); if (response != null) { FacebookRequestError error = response.getError(); JSONObject responseJSON = response.getJSONObject(); if (error != null) { if (!attemptRetry(error.getSubErrorCode())) { handleError(new FacebookGraphResponseException(response, ERROR_UPLOAD)); } } else if (responseJSON != null) { try { handleSuccess(responseJSON); } catch (JSONException e) { endUploadWithFailure(new FacebookException(ERROR_BAD_SERVER_RESPONSE, e)); } } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } }
private static void invokeOnErrorCallback( FacebookCallback<Sharer.Result> callback, GraphResponse response, String message) { logShareResult(AnalyticsEvents.PARAMETER_SHARE_OUTCOME_ERROR, message); if (callback != null) { callback.onError(new FacebookGraphResponseException(response, message)); } }
protected void executeGraphRequestSynchronously(Bundle parameters) { GraphRequest request = new GraphRequest( uploadContext.accessToken, String.format(Locale.ROOT, "%s/videos", uploadContext.targetId), parameters, HttpMethod.POST, null); GraphResponse response = request.executeAndWait(); if (response != null) { FacebookRequestError error = response.getError(); JSONObject responseJSON = response.getJSONObject(); if (error != null) { if (!attemptRetry(error.getSubErrorCode())) { handleError(new FacebookGraphResponseException(response, ERROR_UPLOAD)); } } else if (responseJSON != null) { try { handleSuccess(responseJSON); } catch (JSONException e) { endUploadWithFailure(new FacebookException(ERROR_BAD_SERVER_RESPONSE, e)); } } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } } else { handleError(new FacebookException(ERROR_BAD_SERVER_RESPONSE)); } }