public class GraphServiceException extends ClientException
Modifier and Type | Field and Description |
---|---|
static int |
INTERNAL_SERVER_ERROR
The internal server error threshold defined by the HTTP protocol
|
protected static int |
MAX_BREVITY_LENGTH
The maximum length for a single line string when trying to be brief
|
protected static int |
MAX_BYTE_COUNT_BEFORE_TRUNCATION
The number of bytes to display when showing byte array
|
protected static char |
NEW_LINE
New line delimiter
|
protected static java.lang.String |
TRUNCATION_MARKER
How truncated values are shown
|
Modifier | Constructor and Description |
---|---|
protected |
GraphServiceException(java.lang.String method,
java.lang.String url,
java.util.List<java.lang.String> requestHeaders,
java.lang.String requestBody,
int responseCode,
java.lang.String responseMessage,
java.util.List<java.lang.String> responseHeaders,
GraphErrorResponse error,
boolean verbose)
Create a Graph service exception
|
Modifier and Type | Method and Description |
---|---|
static <T> GraphServiceException |
createFromConnection(IHttpRequest request,
T serializable,
ISerializer serializer,
IConnection connection,
ILogger logger)
Creates a Graph service exception from a given failed HTTP request
|
static <T> GraphServiceException |
createFromConnection(IHttpRequest request,
T serializable,
ISerializer serializer,
okhttp3.Response response,
ILogger logger)
Creates a Graph service exception from a given failed HTTP request
|
java.lang.String |
getMessage() |
java.lang.String |
getMessage(boolean verbose)
Gets the message for this exception
|
int |
getResponseCode()
Gets the The HTTP status code
|
java.lang.String |
getResponseMessage()
Gets the The HTTP response message
|
GraphError |
getServiceError()
Gets the error message from the Graph service object
|
protected static final char NEW_LINE
protected static final java.lang.String TRUNCATION_MARKER
protected static final int MAX_BREVITY_LENGTH
protected static final int MAX_BYTE_COUNT_BEFORE_TRUNCATION
public static final int INTERNAL_SERVER_ERROR
protected GraphServiceException(java.lang.String method, java.lang.String url, java.util.List<java.lang.String> requestHeaders, java.lang.String requestBody, int responseCode, java.lang.String responseMessage, java.util.List<java.lang.String> responseHeaders, GraphErrorResponse error, boolean verbose)
method
- the method that caused the exceptionurl
- the URLrequestHeaders
- the request headersrequestBody
- the request bodyresponseCode
- the response coderesponseMessage
- the response messageresponseHeaders
- the response headerserror
- the error response if availableverbose
- the error response log levelpublic java.lang.String getResponseMessage()
public java.lang.String getMessage()
getMessage
in class java.lang.Throwable
public int getResponseCode()
public java.lang.String getMessage(boolean verbose)
verbose
- if the message should be brief or more verbosepublic GraphError getServiceError()
public static <T> GraphServiceException createFromConnection(IHttpRequest request, T serializable, ISerializer serializer, IConnection connection, ILogger logger) throws java.io.IOException
T
- the type of the serializable objectrequest
- the request that resulted in this failureserializable
- the serialized object that was sent with this requestserializer
- the serializer to re-create the option in its over the wire stateconnection
- the connection that was used to extract the response information fromlogger
- the logger to log exception information tojava.io.IOException
- an exception occurs if there were any problems processing the connectionpublic static <T> GraphServiceException createFromConnection(IHttpRequest request, T serializable, ISerializer serializer, okhttp3.Response response, ILogger logger) throws java.io.IOException
T
- the type of the serializable objectrequest
- the request that resulted in this failureserializable
- the serialized object that was sent with this requestserializer
- the serializer to re-create the option in its over the wire stateresponse
- the response being used to extract information fromlogger
- the logger to log exception information tojava.io.IOException
- an exception occurs if there were any problems processing the connection