Class CosmosException
The Cosmos Client exception
public class CosmosException : Exception, ISerializable
- Inheritance
-
CosmosException
- Implements
- Inherited Members
- Extension Methods
Constructors
CosmosException(string, HttpStatusCode, int, string, double)
Create a CosmosException
public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge)
Parameters
message
stringThe message associated with the exception.
statusCode
HttpStatusCodeThe HttpStatusCode associated with the exception.
subStatusCode
intA sub status code associated with the exception.
activityId
stringAn ActivityId associated with the operation that generated the exception.
requestCharge
doubleA request charge associated with the operation that generated the exception.
Properties
ActivityId
Gets the activity ID for the request from the Azure Cosmos DB service.
public virtual string ActivityId { get; }
Property Value
- string
The activity ID for the request.
Diagnostics
Gets the diagnostics for the request
public virtual CosmosDiagnostics Diagnostics { get; }
Property Value
Headers
Gets the response headers
public virtual Headers Headers { get; }
Property Value
Message
public override string Message { get; }
Property Value
RequestCharge
Gets the request charge for this request from the Azure Cosmos DB service.
public virtual double RequestCharge { get; }
Property Value
- double
The request charge measured in request units.
ResponseBody
The body of the cosmos response message as a string
public virtual string ResponseBody { get; }
Property Value
RetryAfter
Gets the retry after time. This tells how long a request should wait before doing a retry.
public virtual TimeSpan? RetryAfter { get; }
Property Value
StackTrace
public override string StackTrace { get; }
Property Value
StatusCode
Gets the request completion status code from the Azure Cosmos DB service.
public virtual HttpStatusCode StatusCode { get; }
Property Value
- HttpStatusCode
The request completion status code
SubStatusCode
Gets the request completion sub status code from the Azure Cosmos DB service.
public virtual int SubStatusCode { get; }
Property Value
- int
The request completion status code
Methods
ToString()
Create a custom string with all the relevant exception information
public override string ToString()
Returns
- string
A string representation of the exception.
TryGetHeader(string, out string)
Try to get a header from the cosmos response message
public virtual bool TryGetHeader(string headerName, out string value)
Parameters
Returns
- bool
A value indicating if the header was read.