ServiceBusError

Enum ServiceBusError 

Source
pub enum ServiceBusError {
Show 25 variants AzureApiError { code: String, status_code: u16, message: String, request_id: Option<String>, operation: String, }, ConnectionFailed(String), ConnectionLost(String), AuthenticationFailed(String), AuthenticationError(String), ConsumerCreationFailed(String), ConsumerNotFound, ConsumerAlreadyExists(String), ProducerCreationFailed(String), ProducerNotFound(String), MessageReceiveFailed(String), MessageSendFailed(String), MessageCompleteFailed(String), MessageAbandonFailed(String), MessageDeadLetterFailed(String), BulkOperationFailed(String), BulkOperationPartialFailure { successful: usize, failed: usize, errors: Vec<String>, }, QueueNotFound(String), QueueSwitchFailed(String), InvalidQueueName(String), ConfigurationError(String), InvalidConfiguration(String), OperationTimeout(String), InternalError(String), Unknown(String),
}
Expand description

Comprehensive error type for all Service Bus operations.

Provides detailed error information with appropriate context for debugging and user feedback. Includes specialized variants for different operation types and Azure API integration.

§Error Categories

  • Azure API Errors - Detailed Azure service errors with request tracking
  • Connection Errors - Authentication and connection issues
  • Consumer/Producer Errors - Client creation and management errors
  • Message Operation Errors - Message handling failures
  • Bulk Operation Errors - Batch operation failures with partial success tracking
  • Queue Errors - Queue management and navigation errors
  • Configuration Errors - Invalid configuration or setup issues

§Examples

use quetty_server::service_bus_manager::{ServiceBusError, ServiceBusResult};

fn handle_error(error: ServiceBusError) {
    match error {
        ServiceBusError::QueueNotFound(queue) => {
            eprintln!("Queue '{}' does not exist", queue);
        }
        ServiceBusError::AzureApiError { code, message, .. } => {
            eprintln!("Azure API error {}: {}", code, message);
        }
        _ => eprintln!("Service Bus error: {}", error),
    }
}

Variants§

§

AzureApiError

Azure API specific errors with full context for debugging and support.

Contains detailed information about Azure service errors including error codes, HTTP status, and request tracking information.

Fields

§code: String

Azure error code (e.g., “SubscriptionNotFound”, “Unauthorized”)

§status_code: u16

HTTP status code from the API response

§message: String

Human-readable error message from Azure

§request_id: Option<String>

Azure request ID for tracking and support

§operation: String

Operation that failed (e.g., “list_subscriptions”, “send_message”)

§

ConnectionFailed(String)

Connection establishment failed

§

ConnectionLost(String)

Existing connection was lost during operation

§

AuthenticationFailed(String)

Authentication process failed

§

AuthenticationError(String)

Authentication configuration or credential error

§

ConsumerCreationFailed(String)

Message consumer creation failed

§

ConsumerNotFound

No consumer found for the current context

§

ConsumerAlreadyExists(String)

Consumer already exists for the specified queue

§

ProducerCreationFailed(String)

Message producer creation failed

§

ProducerNotFound(String)

No producer found for the specified queue

§

MessageReceiveFailed(String)

Message receive operation failed

§

MessageSendFailed(String)

Message send operation failed

§

MessageCompleteFailed(String)

Message completion failed

§

MessageAbandonFailed(String)

Message abandon operation failed

§

MessageDeadLetterFailed(String)

Message dead letter operation failed

§

BulkOperationFailed(String)

Bulk operation failed completely

§

BulkOperationPartialFailure

Bulk operation partially failed with detailed results

Fields

§successful: usize

Number of successful operations

§failed: usize

Number of failed operations

§errors: Vec<String>

Detailed error messages for failed operations

§

QueueNotFound(String)

Specified queue does not exist

§

QueueSwitchFailed(String)

Failed to switch to the specified queue

§

InvalidQueueName(String)

Queue name format is invalid

§

ConfigurationError(String)

Configuration value is missing or invalid

§

InvalidConfiguration(String)

Configuration format or structure is invalid

§

OperationTimeout(String)

Operation exceeded timeout limit

§

InternalError(String)

Internal service error

§

Unknown(String)

Unknown or unexpected error

Implementations§

Source§

impl ServiceBusError

Source

pub fn azure_api_error( operation: impl Into<String>, code: impl Into<String>, status_code: u16, message: impl Into<String>, ) -> Self

Creates an Azure API error with full context.

§Arguments
  • operation - The operation that failed (e.g., “list_queues”)
  • code - Azure error code (e.g., “Unauthorized”)
  • status_code - HTTP status code from the response
  • message - Human-readable error message
§Returns

A new ServiceBusError::AzureApiError instance

Source

pub fn azure_api_error_with_request_id( operation: impl Into<String>, code: impl Into<String>, status_code: u16, message: impl Into<String>, request_id: impl Into<String>, ) -> Self

Creates an Azure API error with request ID for tracing.

§Arguments
  • operation - The operation that failed
  • code - Azure error code
  • status_code - HTTP status code
  • message - Error message
  • request_id - Azure request ID for support tracking
§Returns

A new ServiceBusError::AzureApiError with request ID

Source

pub async fn from_azure_response( response: Response, operation: impl Into<String>, ) -> Self

Extracts Azure error details from a reqwest Response.

Parses Azure API error responses and extracts structured error information including request IDs for tracking. Handles both JSON and plain text responses.

§Arguments
  • response - The HTTP response from Azure API
  • operation - The operation that resulted in this response
§Returns

A ServiceBusError::AzureApiError with extracted details

Source

pub fn is_azure_api_error(&self) -> bool

Checks if this is an Azure API error.

§Returns

true if this is an [AzureApiError], false otherwise

Source

pub fn azure_error_code(&self) -> Option<&str>

Gets the Azure error code if this is an Azure API error.

§Returns

The Azure error code as a string slice, or None if not an Azure API error

Source

pub fn azure_request_id(&self) -> Option<&str>

Gets the Azure request ID if available.

Request IDs are useful for tracking issues with Azure support.

§Returns

The Azure request ID as a string slice, or None if not available

Trait Implementations§

Source§

impl Clone for ServiceBusError

Source§

fn clone(&self) -> ServiceBusError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServiceBusError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ServiceBusError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ServiceBusError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Box<dyn Error + Send + Sync>> for ServiceBusError

Source§

fn from(err: Box<dyn Error + Send + Sync>) -> Self

Converts to this type from the input type.
Source§

impl From<CacheError> for ServiceBusError

Source§

fn from(err: CacheError) -> Self

Converts to this type from the input type.
Source§

impl From<Elapsed> for ServiceBusError

Source§

fn from(err: Elapsed) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ServiceBusError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<HttpError> for ServiceBusError

Source§

fn from(err: HttpError) -> Self

Converts to this type from the input type.
Source§

impl From<TokenRefreshError> for ServiceBusError

Source§

fn from(err: TokenRefreshError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> SendBound for T
where T: Send,