Package com.azure.data.cosmos
Class CosmosClientException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- com.azure.data.cosmos.CosmosClientException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BadRequestException
,ConflictException
,ForbiddenException
,GoneException
,InternalServerErrorException
,InvalidPartitionException
,LockedException
,MethodNotAllowedException
,NotFoundException
,PartitionIsMigratingException
,PartitionKeyRangeGoneException
,PartitionKeyRangeIsSplittingException
,PreconditionFailedException
,RequestEntityTooLargeException
,RequestRateTooLargeException
,RequestTimeoutException
,RetryWithException
,ServiceUnavailableException
,UnauthorizedException
public class CosmosClientException extends Exception
This class defines a custom exception type for all operations on DocumentClient in the Azure Cosmos DB database service. Applications are expected to catch CosmosClientException and handle errors as appropriate when calling methods on DocumentClient.Errors coming from the service during normal execution are converted to CosmosClientException 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 CosmosClientException.
When a transport level error happens that request is not able to reach the service, an IllegalStateException is thrown instead of CosmosClientException.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CosmosResponseDiagnostics
cosmosResponseDiagnostics()
Gets the Cosmos Response Diagnostic Statistics associated with this exception.CosmosError
error()
Gets the error code associated with the exception.String
getMessage()
String
message()
Gets the activity ID associated with the request.Map<String,String>
responseHeaders()
Gets the response headers as key-value pairslong
retryAfterInMilliseconds()
Gets the recommended time interval after which the client can retry failed requestsint
statusCode()
Gets the http status code.int
subStatusCode()
Gets the sub status code.String
toString()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Method Detail
-
getMessage
public String getMessage()
- Overrides:
getMessage
in classThrowable
-
message
public String message()
Gets the activity ID associated with the request.- Returns:
- the activity ID.
-
statusCode
public int statusCode()
Gets the http status code.- Returns:
- the status code.
-
subStatusCode
public int subStatusCode()
Gets the sub status code.- Returns:
- the status code.
-
error
public CosmosError error()
Gets the error code associated with the exception.- Returns:
- the error.
-
retryAfterInMilliseconds
public long retryAfterInMilliseconds()
Gets the recommended time interval after which the client can retry failed requests- Returns:
- the recommended time interval after which the client can retry failed requests.
-
responseHeaders
public Map<String,String> responseHeaders()
Gets the response headers as key-value pairs- Returns:
- the response headers
-
cosmosResponseDiagnostics
public CosmosResponseDiagnostics cosmosResponseDiagnostics()
Gets the Cosmos Response Diagnostic Statistics associated with this exception.- Returns:
- Cosmos Response Diagnostic Statistics associated with this exception.
-
-