This class represents an error that occurred during a Facebook request.
In general, one would call FacebookRequestError.getCategory() to determine the type of error that occurred, and act accordingly. The app can also call FacebookRequestError.getUserActionMessageId() in order to get the resource id for a string that can be displayed to the user. For more information on error handling, see https://developers.facebook.com/docs/reference/api/errors/
Perpanjang: | Object |
Paket: | facebook |
FacebookRequestError(int, String, String)
public FacebookRequestError(int errorCode, String errorType, String errorMessage)
Parameter | Keterangan |
---|---|
errorCode | |
errorType | |
errorMessage |
getUserActionMessageId()
Returns the resource id for a user-friendly message for the application to present to the user.
public int getUserActionMessageId()
shouldNotifyUser()
Returns whether direct user action is required to successfully continue with the Facebook operation. If user action is required, apps can also call FacebookRequestError.getUserActionMessageId() in order to get a resource id for a message to show the user.
public boolean shouldNotifyUser()
getCategory()
Returns the category in which the error belongs. Applications can use the category to determine how best to handle the errors (e.g. exponential backoff for retries if being throttled).
public Category getCategory()
getRequestStatusCode()
Returns the HTTP status code for this particular request.
public int getRequestStatusCode()
getErrorCode()
Returns the error code returned from Facebook.
public int getErrorCode()
getSubErrorCode()
Returns the sub-error code returned from Facebook.
public int getSubErrorCode()
getErrorType()
Returns the type of error as a raw string. This is generally less useful than using the FacebookRequestError.getCategory() method, but can provide further details on the error.
public String getErrorType()
getErrorMessage()
Returns the error message returned from Facebook.
public String getErrorMessage()
getRequestResultBody()
Returns the body portion of the response corresponding to the request from Facebook.
public JSONObject getRequestResultBody()
getRequestResult()
Returns the full JSON response for the corresponding request. In a non-batch request, this would be the raw response in the form of a JSON object. In a batch request, this result will contain the body of the response as well as the HTTP headers that pertain to the specific request (in the form of a "headers" JSONArray).
public JSONObject getRequestResult()
getBatchRequestResult()
Returns the full JSON response for the batch request. If the request was not a batch request, then the result from this method is the same as FacebookRequestError.getRequestResult(). In case of a batch request, the result will be a JSONArray where the elements correspond to the requests in the batch. Callers should check the return type against either JSONObject or JSONArray and cast accordingly.
public Object getBatchRequestResult()
getConnection()
Returns the HTTP connection that was used to make the request.
public HttpURLConnection getConnection()
getException()
Returns the exception associated with this request, if any.
public FacebookException getException()
INVALID_ERROR_CODE
public static final int INVALID_ERROR_CODE
INVALID_HTTP_STATUS_CODE
public static final int INVALID_HTTP_STATUS_CODE