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
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
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
impl ServiceBusError
Sourcepub fn azure_api_error(
operation: impl Into<String>,
code: impl Into<String>,
status_code: u16,
message: impl Into<String>,
) -> Self
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 responsemessage- Human-readable error message
§Returns
A new ServiceBusError::AzureApiError instance
Sourcepub 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
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 failedcode- Azure error codestatus_code- HTTP status codemessage- Error messagerequest_id- Azure request ID for support tracking
§Returns
A new ServiceBusError::AzureApiError with request ID
Sourcepub async fn from_azure_response(
response: Response,
operation: impl Into<String>,
) -> Self
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 APIoperation- The operation that resulted in this response
§Returns
A ServiceBusError::AzureApiError with extracted details
Sourcepub fn is_azure_api_error(&self) -> bool
pub fn is_azure_api_error(&self) -> bool
Sourcepub fn azure_error_code(&self) -> Option<&str>
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
Sourcepub fn azure_request_id(&self) -> Option<&str>
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
impl Clone for ServiceBusError
Source§fn clone(&self) -> ServiceBusError
fn clone(&self) -> ServiceBusError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServiceBusError
impl Debug for ServiceBusError
Source§impl Display for ServiceBusError
impl Display for ServiceBusError
Source§impl Error for ServiceBusError
impl Error for ServiceBusError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<CacheError> for ServiceBusError
impl From<CacheError> for ServiceBusError
Source§fn from(err: CacheError) -> Self
fn from(err: CacheError) -> Self
Source§impl From<Elapsed> for ServiceBusError
impl From<Elapsed> for ServiceBusError
Source§impl From<Error> for ServiceBusError
impl From<Error> for ServiceBusError
Source§impl From<HttpError> for ServiceBusError
impl From<HttpError> for ServiceBusError
Source§impl From<TokenRefreshError> for ServiceBusError
impl From<TokenRefreshError> for ServiceBusError
Source§fn from(err: TokenRefreshError) -> Self
fn from(err: TokenRefreshError) -> Self
Auto Trait Implementations§
impl Freeze for ServiceBusError
impl RefUnwindSafe for ServiceBusError
impl Send for ServiceBusError
impl Sync for ServiceBusError
impl Unpin for ServiceBusError
impl UnwindSafe for ServiceBusError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.