pub enum ServerError {
Show 18 variants
Core(RegistryError),
Transport(TransportError),
Handler {
message: String,
context: Option<String>,
},
Configuration {
message: String,
key: Option<String>,
},
Authentication {
message: String,
method: Option<String>,
},
Authorization {
message: String,
resource: Option<String>,
},
RateLimit {
message: String,
retry_after: Option<u64>,
},
Lifecycle(String),
Shutdown(String),
Middleware {
name: String,
message: String,
},
Registry(String),
Routing {
message: String,
method: Option<String>,
},
NotFound {
resource: String,
},
Internal(String),
Io(Error),
Serialization(Error),
Timeout {
operation: String,
timeout_ms: u64,
},
ResourceExhausted {
resource: String,
current: Option<usize>,
max: Option<usize>,
},
}
Expand description
Comprehensive server error types
Variants§
Core(RegistryError)
Core errors
Transport(TransportError)
Transport layer errors
Handler
Handler registration errors
Configuration
Configuration errors
Authentication
Authentication errors
Authorization
Authorization errors
RateLimit
Rate limiting errors
Lifecycle(String)
Server lifecycle errors
Shutdown(String)
Server shutdown errors
Middleware
Middleware errors
Registry(String)
Registry errors
Routing
Routing errors
NotFound
Resource not found
Internal(String)
Internal server errors
Io(Error)
IO errors
Serialization(Error)
Serialization errors
Timeout
Timeout errors
ResourceExhausted
Resource exhaustion
Implementations§
Source§impl ServerError
impl ServerError
Sourcepub fn handler_with_context(
message: impl Into<String>,
context: impl Into<String>,
) -> Self
pub fn handler_with_context( message: impl Into<String>, context: impl Into<String>, ) -> Self
Create a handler error with context
Sourcepub fn configuration(message: impl Into<String>) -> Self
pub fn configuration(message: impl Into<String>) -> Self
Create a new configuration error
Sourcepub fn configuration_with_key(
message: impl Into<String>,
key: impl Into<String>,
) -> Self
pub fn configuration_with_key( message: impl Into<String>, key: impl Into<String>, ) -> Self
Create a configuration error with key
Sourcepub fn authentication(message: impl Into<String>) -> Self
pub fn authentication(message: impl Into<String>) -> Self
Create a new authentication error
Sourcepub fn authentication_with_method(
message: impl Into<String>,
method: impl Into<String>,
) -> Self
pub fn authentication_with_method( message: impl Into<String>, method: impl Into<String>, ) -> Self
Create an authentication error with method
Create a new authorization error
Create an authorization error with resource
Sourcepub fn rate_limit(message: impl Into<String>) -> Self
pub fn rate_limit(message: impl Into<String>) -> Self
Create a new rate limit error
Sourcepub fn rate_limit_with_retry(
message: impl Into<String>,
retry_after: u64,
) -> Self
pub fn rate_limit_with_retry( message: impl Into<String>, retry_after: u64, ) -> Self
Create a rate limit error with retry after
Sourcepub fn middleware(name: impl Into<String>, message: impl Into<String>) -> Self
pub fn middleware(name: impl Into<String>, message: impl Into<String>) -> Self
Create a new middleware error
Sourcepub fn routing_with_method(
message: impl Into<String>,
method: impl Into<String>,
) -> Self
pub fn routing_with_method( message: impl Into<String>, method: impl Into<String>, ) -> Self
Create a routing error with method
Sourcepub fn resource_exhausted(resource: impl Into<String>) -> Self
pub fn resource_exhausted(resource: impl Into<String>) -> Self
Create a resource exhausted error
Sourcepub fn resource_exhausted_with_usage(
resource: impl Into<String>,
current: usize,
max: usize,
) -> Self
pub fn resource_exhausted_with_usage( resource: impl Into<String>, current: usize, max: usize, ) -> Self
Create a resource exhausted error with usage info
Sourcepub const fn is_retryable(&self) -> bool
pub const fn is_retryable(&self) -> bool
Check if this error is retryable
Sourcepub const fn error_code(&self) -> i32
pub const fn error_code(&self) -> i32
Get error code for JSON-RPC responses