/// <summary> /// Initializes a new instance of the <see cref="ServiceBusException"/> class. /// </summary> /// /// <param name="isTransient"><c>true</c> if the exception should be considered transient; otherwise, <c>false</c>.</param> /// <param name="message">The error message that explains the reason for the exception.</param> /// <param name="entityName">The name of the Service Bus entity to which the exception is associated.</param> /// <param name="reason">The reason for the failure that resulted in the exception.</param> /// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param> /// public ServiceBusException(bool isTransient, string message, string entityName = default, ServiceBusFailureReason reason = ServiceBusFailureReason.GeneralError, Exception innerException = default) : base(message, innerException) { IsTransient = isTransient; EntityPath = entityName; Reason = reason; }
/// <summary> /// Initializes a new instance of the <see cref="ServiceBusException"/> class, using the <paramref name="reason"/> /// to detect whether or not it should be transient. /// </summary> /// /// <param name="message">The error message that explains the reason for the exception.</param> /// <param name="reason">The reason for the failure that resulted in the exception.</param> /// <param name="entityPath">The name of the Service Bus entity to which the exception is associated.</param> /// <param name="innerException"></param> /// public ServiceBusException( string message, ServiceBusFailureReason reason, string entityPath = default, Exception innerException = default) : this(default, message, entityPath, reason, innerException) { switch (reason) { case ServiceBusFailureReason.ServiceCommunicationProblem: case ServiceBusFailureReason.ServiceTimeout: case ServiceBusFailureReason.ServiceBusy: IsTransient = true; break; default: IsTransient = false; break; } }