DocumentClientException Class
- java.
lang. Object - Exception
- com.
microsoft. azure. cosmosdb. DocumentClientException
- com.
public class DocumentClientException
This class defines a custom exception type for all operations on DocumentClient in the Azure Cosmos DB database service. Applications are expected to catch DocumentClientException and handle errors as appropriate when calling methods on DocumentClient.
Errors coming from the service during normal execution are converted to DocumentClientException before returning to the application with the following exception:
When a BE error is encountered during a QueryIterable<T> iteration, an IllegalStateException is thrown instead of DocumentClientException.
When a transport level error happens that request is not able to reach the service, an IllegalStateException is thrown instead of DocumentClientException.
Constructor Summary
Constructor | Description |
---|---|
DocumentClientException(int statusCode) |
Creates a new instance of the DocumentClientException class. |
DocumentClientException(int statusCode, Error errorResource, Map<String, String> responseHeaders) |
Creates a new instance of the DocumentClientException class. |
DocumentClientException(int statusCode, Exception innerException) |
Creates a new instance of the DocumentClientException class. |
DocumentClientException(int statusCode, String errorMessage) |
Creates a new instance of the DocumentClientException class. |
DocumentClientException(String message, Exception exception, Map<String, String> responseHeaders, int statusCode, String resourceAddress) |
Creates a new instance of the DocumentClientException class. |
DocumentClientException(String resourceAddress, int statusCode, Error errorResource, Map<String, String> responseHeaders) |
Creates a new instance of the DocumentClientException class. |
Method Summary
Modifier and Type | Method and Description |
---|---|
String |
getActivityId()
Gets the activity ID associated with the request. |
Client |
getClientSideRequestStatistics()
Gets the Client side request statistics associated with this exception. |
Error |
getError()
Gets the error code associated with the exception. |
long |
getLsn()
Gets the LSN associated with this DocumentClientException. |
String | getMessage() |
String | getPartitionKeyRangeId() |
Map<String, String> | getRequestHeaders() |
Uri | getRequestUri() |
Map<String, String> |
getResponseHeaders()
Gets the response headers as key-value pairs |
long |
getRetryAfterInMilliseconds()
Gets the recommended time interval after which the client can retry failed requests |
int |
getStatusCode()
Gets the http status code. |
int |
getSubStatusCode()
Gets the sub status code. |
void |
setClientSideRequestStatistics(ClientSideRequestStatistics clientSideRequestStatistics)
Sets the Client side request statistics associated with this exception. |
void | setRequestUri(Uri requestUri) |
String | toString() |
Constructor Details
DocumentClientException
public DocumentClientException(int statusCode)
Creates a new instance of the DocumentClientException class.
Parameters:
DocumentClientException
public DocumentClientException(int statusCode, Error errorResource, Map
Creates a new instance of the DocumentClientException class.
Parameters:
DocumentClientException
public DocumentClientException(int statusCode, Exception innerException)
Creates a new instance of the DocumentClientException class.
Parameters:
DocumentClientException
public DocumentClientException(int statusCode, String errorMessage)
Creates a new instance of the DocumentClientException class.
Parameters:
DocumentClientException
public DocumentClientException(String message, Exception exception, Map
Creates a new instance of the DocumentClientException class.
Parameters:
DocumentClientException
public DocumentClientException(String resourceAddress, int statusCode, Error errorResource, Map
Creates a new instance of the DocumentClientException class.
Parameters:
Method Details
getActivityId
public String getActivityId()
Gets the activity ID associated with the request.
Returns:
getClientSideRequestStatistics
public ClientSideRequestStatistics getClientSideRequestStatistics()
Gets the Client side request statistics associated with this exception.
Returns:
getError
public Error getError()
Gets the error code associated with the exception.
Returns:
getLsn
public long getLsn()
Gets the LSN associated with this DocumentClientException.
Returns:
getMessage
public String getMessage()
getPartitionKeyRangeId
public String getPartitionKeyRangeId()
getRequestHeaders
public Map
getRequestUri
public Uri getRequestUri()
getResponseHeaders
public Map
Gets the response headers as key-value pairs
Returns:
getRetryAfterInMilliseconds
public long getRetryAfterInMilliseconds()
Gets the recommended time interval after which the client can retry failed requests
Returns:
getStatusCode
public int getStatusCode()
Gets the http status code.
Returns:
getSubStatusCode
public int getSubStatusCode()
Gets the sub status code.
Returns:
setClientSideRequestStatistics
public void setClientSideRequestStatistics(ClientSideRequestStatistics clientSideRequestStatistics)
Sets the Client side request statistics associated with this exception.
Parameters:
setRequestUri
public void setRequestUri(Uri requestUri)
Parameters:
toString
public String toString()
Applies to
Azure SDK for Java