pub struct TransportError {
pub Code: TransportErrorCode,
pub Message: String,
pub Source: Option<Box<dyn Error + Send + Sync>>,
pub TransportKind: String,
pub Method: Option<String>,
pub CorrelationIdentifier: Option<String>,
pub RetryAttempt: u32,
pub Context: HashMap<String, String>,
}Expand description
Unified transport error.
Fields§
§Code: TransportErrorCodeError code indicating the type of failure.
Message: StringHuman-readable error message.
Source: Option<Box<dyn Error + Send + Sync>>Optional underlying/boxed error.
TransportKind: StringThe transport type that generated this error.
Method: Option<String>The method being invoked when the error occurred (if applicable).
CorrelationIdentifier: Option<String>The correlation/request ID for tracing.
RetryAttempt: u32Number of retry attempts before this failure.
Context: HashMap<String, String>Additional error context as key-value pairs.
Implementations§
Source§impl TransportError
impl TransportError
Sourcepub fn New(Code: TransportErrorCode, Message: impl Into<String>) -> Self
pub fn New(Code: TransportErrorCode, Message: impl Into<String>) -> Self
Creates a new TransportError with the given code and message.
Sourcepub fn WithTransportKind(self, TransportKind: &str) -> Self
pub fn WithTransportKind(self, TransportKind: &str) -> Self
Sets the transport type on this error.
Sourcepub fn WithMethod(self, Method: &str) -> Self
pub fn WithMethod(self, Method: &str) -> Self
Sets the method name on this error.
Sourcepub fn WithCorrelationIdentifier(self, CorrelationIdentifier: &str) -> Self
pub fn WithCorrelationIdentifier(self, CorrelationIdentifier: &str) -> Self
Sets the correlation/request ID on this error.
Sourcepub fn WithRetryAttempt(self, RetryAttempt: u32) -> Self
pub fn WithRetryAttempt(self, RetryAttempt: u32) -> Self
Sets the retry attempt count.
Sourcepub fn WithContext(self, Key: &str, Value: &str) -> Self
pub fn WithContext(self, Key: &str, Value: &str) -> Self
Adds a context key-value pair to this error.
Sourcepub fn WithSource(self, SourceError: impl Error + Send + Sync + 'static) -> Self
pub fn WithSource(self, SourceError: impl Error + Send + Sync + 'static) -> Self
Sets the underlying source error.
Sourcepub fn IsRetryable(&self) -> bool
pub fn IsRetryable(&self) -> bool
Returns true if this error is retryable.
Sourcepub fn RetryDelayMilliseconds(&self) -> u64
pub fn RetryDelayMilliseconds(&self) -> u64
Returns the recommended retry delay in milliseconds.
Sourcepub fn FullMessage(&self) -> String
pub fn FullMessage(&self) -> String
Returns the full error message with all context included.
Source§impl TransportError
Convenience constructors for common transport errors.
impl TransportError
Convenience constructors for common transport errors.
Sourcepub fn Connection(Message: impl Into<String>) -> Self
pub fn Connection(Message: impl Into<String>) -> Self
Connection error: failed to connect or lost connection.
Sourcepub fn InvalidRequest(Message: impl Into<String>) -> Self
pub fn InvalidRequest(Message: impl Into<String>) -> Self
Invalid request error: bad parameters or format.
Sourcepub fn NotSupported(Message: impl Into<String>) -> Self
pub fn NotSupported(Message: impl Into<String>) -> Self
Not supported error: feature not implemented by this transport.
Sourcepub fn Remote(Message: impl Into<String>) -> Self
pub fn Remote(Message: impl Into<String>) -> Self
Remote error: the remote endpoint returned an error.
Sourcepub fn Internal(Message: impl Into<String>) -> Self
pub fn Internal(Message: impl Into<String>) -> Self
Internal error: something went wrong inside the transport.
Sourcepub fn CircuitBreakerOpen() -> Self
pub fn CircuitBreakerOpen() -> Self
Circuit breaker open error: request rejected due to circuit breaker.
Sourcepub fn RateLimited(RetryAfterMilliseconds: u64) -> Self
pub fn RateLimited(RetryAfterMilliseconds: u64) -> Self
Rate limited error: too many requests.
Sourcepub fn MessageTooLarge(Size: usize, MaximumSize: usize) -> Self
pub fn MessageTooLarge(Size: usize, MaximumSize: usize) -> Self
Message too large error.
Sourcepub fn NotFound(Message: impl Into<String>) -> Self
pub fn NotFound(Message: impl Into<String>) -> Self
Not found error: resource or transport not found.
Sourcepub fn Serialization(Message: impl Into<String>) -> Self
pub fn Serialization(Message: impl Into<String>) -> Self
Serialization error.
Trait Implementations§
Source§impl Clone for TransportError
impl Clone for TransportError
Source§impl Debug for TransportError
impl Debug for TransportError
Source§impl Display for TransportError
impl Display for TransportError
Source§impl Error for TransportError
impl Error for TransportError
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 PartialEq for TransportError
impl PartialEq for TransportError
impl Eq for TransportError
Auto Trait Implementations§
impl Freeze for TransportError
impl !RefUnwindSafe for TransportError
impl Send for TransportError
impl Sync for TransportError
impl Unpin for TransportError
impl UnsafeUnpin for TransportError
impl !UnwindSafe for TransportError
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.