/// <summary> /// Constructs a <see cref="BatchException"/> as a wrapper for a <see cref="BatchErrorException"/>. /// </summary> /// <param name="batchErrorException">The exception to wrap.</param> internal BatchException(BatchErrorException batchErrorException) : base(batchErrorException.Message, batchErrorException) { //Process client request id header string clientRequestIdString = TryGetSingleHeaderOrDefault(InternalConstants.ClientRequestIdHeader, batchErrorException.Response.Headers); //Process request id header string requestIdString = TryGetSingleHeaderOrDefault(InternalConstants.RequestIdHeader, batchErrorException.Response.Headers); //Process retry-after header string retryAfterString = TryGetSingleHeaderOrDefault(InternalConstants.RetryAfterHeader, batchErrorException.Response.Headers); var retryAfter = ExtractRetryAfterHeader(retryAfterString); this.RequestInformation = new RequestInformation() { BatchError = batchErrorException.Body == null ? null : new BatchError(batchErrorException.Body), ClientRequestId = string.IsNullOrEmpty(clientRequestIdString) ? default(Guid?) : new Guid(clientRequestIdString), HttpStatusCode = batchErrorException.Response.StatusCode, HttpStatusMessage = batchErrorException.Response.ReasonPhrase, //TODO: Is this right? ServiceRequestId = requestIdString, RetryAfter = retryAfter }; }
/// <summary> /// Initializes a new instance of the <see cref="BatchException"/> class by using the specified parameters. /// </summary> /// <param name="requestInformation">A <see cref="RequestInformation"/> object containing details about the request.</param> /// <param name="message">The exception message.</param> /// <param name="inner">The inner exception.</param> public BatchException(RequestInformation requestInformation, string message, Exception inner) : base(message, inner) { this.RequestInformation = requestInformation; }
/// <summary> /// Initializes a new <see cref="RequestResult"/>. /// </summary> /// <param name="requestInformation">The information associated with the individual request.</param> /// <param name="exception">The exception hit during the execution of the request (or null if there was no exception).</param> public RequestResult(RequestInformation requestInformation, Exception exception) { this.RequestInformation = requestInformation; this.Exception = exception; }