internal CosmosException(
            HttpStatusCode statusCodes,
            string message,
            int subStatusCode,
            string stackTrace,
            string activityId,
            double requestCharge,
            TimeSpan?retryAfter,
            Headers headers,
            CosmosDiagnosticsContext diagnosticsContext,
            Error error,
            Exception innerException)
            : base(CosmosException.GetMessageHelper(
                       statusCodes,
                       subStatusCode,
                       message,
                       activityId), innerException)
        {
            this.ResponseBody  = message;
            this.stackTrace    = stackTrace;
            this.ActivityId    = activityId;
            this.StatusCode    = statusCodes;
            this.SubStatusCode = subStatusCode;
            this.RetryAfter    = retryAfter;
            this.RequestCharge = requestCharge;
            this.Headers       = headers;
            this.Error         = error;

            // Always have a diagnostic context. A new diagnostic will have useful info like user agent
            this.DiagnosticsContext = diagnosticsContext ?? new CosmosDiagnosticsContextCore();
        }
Example #2
0
 internal CosmosException(
     HttpStatusCode statusCode,
     string message,
     int subStatusCode,
     string stackTrace,
     string activityId,
     double requestCharge,
     TimeSpan?retryAfter,
     Headers headers,
     ITrace trace,
     Error error,
     Exception innerException)
     : base(CosmosException.GetMessageHelper(
                statusCode,
                subStatusCode,
                message,
                activityId), innerException)
 {
     this.ResponseBody  = message;
     this.stackTrace    = stackTrace;
     this.ActivityId    = activityId;
     this.StatusCode    = statusCode;
     this.SubStatusCode = subStatusCode;
     this.RetryAfter    = retryAfter;
     this.RequestCharge = requestCharge;
     this.Headers       = headers;
     this.Error         = error;
     this.Trace         = trace;
 }
 internal CosmosException(
     HttpStatusCode statusCode,
     string message,
     string stackTrace,
     Headers headers,
     ITrace trace,
     Error error,
     Exception innerException)
     : base(CosmosException.GetMessageHelper(
                statusCode,
                headers,
                message), innerException)
 {
     this.ResponseBody = message;
     this.stackTrace   = stackTrace;
     this.StatusCode   = statusCode;
     this.Headers      = headers ?? new Headers();
     this.Error        = error;
     this.Trace        = trace;
 }
 internal CosmosException(
     HttpStatusCode statusCode,
     string message,
     string stackTrace,
     Headers headers,
     ITrace trace,
     Error error,
     Exception innerException)
 // The message is overridden. Base exception does not have CTOR for just innerException and the property is not virtual
     : base(string.Empty, innerException)
 {
     this.ResponseBody = message;
     this.stackTrace   = stackTrace;
     this.StatusCode   = statusCode;
     this.Headers      = headers ?? new Headers();
     this.Error        = error;
     this.Trace        = trace;
     this.Diagnostics  = new CosmosTraceDiagnostics(this.Trace ?? NoOpTrace.Singleton);
     this.lazyMessage  = new Lazy <string>(() => CosmosException.GetMessageHelper(
                                               statusCode,
                                               this.Headers,
                                               this.ResponseBody,
                                               this.Diagnostics));
 }