Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AzureResponseException"/> class
        /// using a <see cref="AzureResponse"/> instance.
        /// </summary>
        /// <param name="response"><see cref="AzureResponse"/> instance containing the response.</param>
        /// <param name="errorMessage">Message describing the error.</param>
        public AzureResponseException(AzureResponse response, string errorMessage) : this(errorMessage)
        {
            Response = response;

            // Build a new fault object
            Fault = AzureResponseHelper.BuildFaultMessage(ErrorMessage, response);
        }
Пример #2
0
 /// <summary>
 /// Builds a new NACK message envelope.
 /// </summary>
 /// <param name="ex"><see cref="Exception"/> instance containing details about an error.</param>
 /// <param name="trackingId">Tracking ID to use for this envelope.</param>
 /// <returns><see cref="JObject"/> instance representing the envelope.</returns>
 public static JObject BuildNackEnvelope(Exception ex, string trackingId = null)
 {
     return BuildNackEnvelope(ex?.Message ?? "(Unknown error)", null, AzureResponseHelper.BuildFaultMessage(ex), trackingId);
 }
Пример #3
0
 /// <summary>
 /// Builds a new NACK message envelope.
 /// </summary>
 /// <param name="message">Fault message.</param>
 /// <param name="code">Fault code.</param>
 /// <param name="reason">Fault reason.</param>
 /// <param name="actor">Fault actor.</param>
 /// <param name="trackingId">Tracking ID to use for this envelope.</param>
 /// <returns><see cref="JObject"/> instance representing the envelope.</returns>
 public static JObject BuildNackEnvelope(string message, string code, string reason = null, string actor = null, string trackingId = null)
 {
     return BuildNackEnvelope(message, code, AzureResponseHelper.BuildFaultMessage(message, code, reason, actor), trackingId);
 }
Пример #4
0
 /// <summary>
 /// Builds a new NACK message envelope.
 /// </summary>
 /// <param name="message">Fault message.</param>
 /// <param name="code">Fault code.</param>
 /// <param name="arex"><see cref="AzureResponseException"/> instance containing details about an error.</param>
 /// <returns><see cref="JObject"/> instance representing the envelope.</returns>
 public static JObject BuildNackEnvelope(string message, string code, AzureResponseException arex)
 {
     return BuildNackEnvelope(message, code, AzureResponseHelper.BuildFaultMessage(arex), arex.Response.TrackingId);
 }
Пример #5
0
 /// <summary>
 /// Builds a new NACK message envelope.
 /// </summary>
 /// <param name="message">Fault message.</param>
 /// <param name="arex"><see cref="AzureResponseException"/> instance containing details about an error.</param>
 /// <returns><see cref="JObject"/> instance representing the envelope.</returns>
 public static JObject BuildNackEnvelope(string message, AzureResponseException arex)
 {
     return BuildNackEnvelope(message, (arex?.Response == null) ? "(Unknown)" : arex.Response?.StatusCode.ToString(), AzureResponseHelper.BuildFaultMessage(arex), arex.Response.TrackingId);
 }
Пример #6
0
 /// <summary>
 /// Builds a new NACK message envelope.
 /// </summary>
 /// <param name="message">Fault message.</param>
 /// <param name="code">Fault code.</param>
 /// <param name="ex"><see cref="Exception"/> instance containing details about an error.</param>
 /// <param name="trackingId">Tracking ID to use for this envelope.</param>
 /// <returns><see cref="JObject"/> instance representing the envelope.</returns>
 public static JObject BuildNackEnvelope(string message, string code, Exception ex, string trackingId = null)
 {
     return BuildNackEnvelope(message, code, AzureResponseHelper.BuildFaultMessage(ex), trackingId);
 }