Package com.restfb.exception
Class FacebookGraphException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.restfb.exception.FacebookException
-
- com.restfb.exception.FacebookErrorMessageException
-
- com.restfb.exception.FacebookGraphException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
FacebookOAuthException
,FacebookQueryParseException
public class FacebookGraphException extends FacebookErrorMessageException
Indicates that the Facebook Graph API endpoint returned JSON which indicates an error condition.Example:
{ "error": { "type": "Exception", "message": "...", "code": 210, "error_subcode": 123, "error_user_title": "A title", "error_user_msg": "A message" } }
- Since:
- 1.5
- Author:
- Mark Allen
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FacebookGraphException(String errorType, String errorMessage, Integer errorCode, Integer errorSubcode, Integer httpStatusCode, String errorUserTitle, String errorUserMessage, Boolean isTransient, JsonObject rawError)
Creates an exception with the given error type and message.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Integer
getErrorCode()
Gets the Facebook API error code.Optional<JsonObject>
getErrorData()
returns the error data as defined here as JsonObject.String
getErrorData(String field)
special method to get the String result to the given field of the error_data fieldString
getErrorMessage()
Gets the Facebook Graph API error message.Integer
getErrorSubcode()
Gets the Facebook API error subcode.String
getErrorType()
Gets the Facebook Graph API error type.String
getErrorUserMessage()
Gets the Facebook API error user message.String
getErrorUserTitle()
Gets the Facebook API error user title.String
getFbtraceId()
Gets the Facebook API errorfbtrace_id
.Integer
getHttpStatusCode()
Gets the HTTP status code returned by the server.Boolean
getIsTransient()
-
Methods inherited from class com.restfb.exception.FacebookErrorMessageException
getDebugHeaderInfo, getRawErrorJson, setDebugHeaderInfo, setRawErrorJson
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
FacebookGraphException
public FacebookGraphException(String errorType, String errorMessage, Integer errorCode, Integer errorSubcode, Integer httpStatusCode, String errorUserTitle, String errorUserMessage, Boolean isTransient, JsonObject rawError)
Creates an exception with the given error type and message.- Parameters:
errorType
- Value of the Facebook response attributeerror.type
.errorMessage
- Value of the Facebook response attributeerror.message
.errorCode
- Value of the Facebook response attributeerror.code
.errorSubcode
- Value of the Facebook response attributeerror.error_subcode
.httpStatusCode
- The HTTP status code returned by the server, e.g. 500.errorUserTitle
- Value of the Facebook response attributeerror.error_user_title
.errorUserMessage
- Value of the Facebook response attributeerror.error_user_msg
.isTransient
-
-
-
Method Detail
-
getErrorType
public String getErrorType()
Gets the Facebook Graph API error type.- Returns:
- The Facebook Graph API error type.
-
getErrorMessage
public String getErrorMessage()
Gets the Facebook Graph API error message.- Returns:
- The Facebook Graph API error message.
-
getErrorCode
public Integer getErrorCode()
Gets the Facebook API error code.- Returns:
- The Facebook API error code.
-
getErrorSubcode
public Integer getErrorSubcode()
Gets the Facebook API error subcode.- Returns:
- The Facebook API error subcode.
-
getHttpStatusCode
public Integer getHttpStatusCode()
Gets the HTTP status code returned by the server.- Returns:
- The HTTP status code returned by the server.
- Since:
- 1.6.10
-
getErrorUserTitle
public String getErrorUserTitle()
Gets the Facebook API error user title.- Returns:
- the Facebook API error user title
- Since:
- 1.7.1
-
getErrorUserMessage
public String getErrorUserMessage()
Gets the Facebook API error user message.- Returns:
- the Facebook API error user message
- Since:
- 1.7.1
-
getIsTransient
public Boolean getIsTransient()
-
getFbtraceId
public String getFbtraceId()
Gets the Facebook API errorfbtrace_id
. Internal support identifier. When reporting a bug related to a Graph API call, include the fbtrace_id to help us find log data for debugging.- Returns:
- the Facebook API error
fbtrace_id
-
getErrorData
public Optional<JsonObject> getErrorData()
returns the error data as defined here as JsonObject. We use no special object to be future proof and allow other error JSONs to use this.- Returns:
- Optional
with the JsonObject
-
getErrorData
public String getErrorData(String field)
special method to get the String result to the given field of the error_data field- Parameters:
field
- field you like to fetch- Returns:
- String with the result or empty String if not available
-
-