ServerError

Enum ServerError 

Source
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

Fields

§message: String

Error message

§context: Option<String>

Optional error context

§

Configuration

Configuration errors

Fields

§message: String

Error message

§key: Option<String>

Configuration key that caused the error

§

Authentication

Authentication errors

Fields

§message: String

Error message

§method: Option<String>

Authentication method that failed

§

Authorization

Authorization errors

Fields

§message: String

Error message

§resource: Option<String>

Resource being accessed

§

RateLimit

Rate limiting errors

Fields

§message: String

Error message

§retry_after: Option<u64>

Retry after seconds

§

Lifecycle(String)

Server lifecycle errors

§

Shutdown(String)

Server shutdown errors

§

Middleware

Middleware errors

Fields

§name: String

Middleware name

§message: String

Error message

§

Registry(String)

Registry errors

§

Routing

Routing errors

Fields

§message: String

Error message

§method: Option<String>

Request method that failed

§

NotFound

Resource not found

Fields

§resource: String

Resource that was not found

§

Internal(String)

Internal server errors

§

Io(Error)

IO errors

§

Serialization(Error)

Serialization errors

§

Timeout

Timeout errors

Fields

§operation: String

Operation that timed out

§timeout_ms: u64

Timeout in milliseconds

§

ResourceExhausted

Resource exhaustion

Fields

§resource: String

Resource type

§current: Option<usize>

Current usage

§max: Option<usize>

Maximum allowed

Implementations§

Source§

impl ServerError

Source

pub fn handler(message: impl Into<String>) -> Self

Create a new handler error

Source

pub fn handler_with_context( message: impl Into<String>, context: impl Into<String>, ) -> Self

Create a handler error with context

Source

pub fn configuration(message: impl Into<String>) -> Self

Create a new configuration error

Source

pub fn configuration_with_key( message: impl Into<String>, key: impl Into<String>, ) -> Self

Create a configuration error with key

Source

pub fn authentication(message: impl Into<String>) -> Self

Create a new authentication error

Source

pub fn authentication_with_method( message: impl Into<String>, method: impl Into<String>, ) -> Self

Create an authentication error with method

Source

pub fn authorization(message: impl Into<String>) -> Self

Create a new authorization error

Source

pub fn authorization_with_resource( message: impl Into<String>, resource: impl Into<String>, ) -> Self

Create an authorization error with resource

Source

pub fn rate_limit(message: impl Into<String>) -> Self

Create a new rate limit error

Source

pub fn rate_limit_with_retry( message: impl Into<String>, retry_after: u64, ) -> Self

Create a rate limit error with retry after

Source

pub fn middleware(name: impl Into<String>, message: impl Into<String>) -> Self

Create a new middleware error

Source

pub fn routing(message: impl Into<String>) -> Self

Create a new routing error

Source

pub fn routing_with_method( message: impl Into<String>, method: impl Into<String>, ) -> Self

Create a routing error with method

Source

pub fn not_found(resource: impl Into<String>) -> Self

Create a not found error

Source

pub fn timeout(operation: impl Into<String>, timeout_ms: u64) -> Self

Create a timeout error

Source

pub fn resource_exhausted(resource: impl Into<String>) -> Self

Create a resource exhausted error

Source

pub fn resource_exhausted_with_usage( resource: impl Into<String>, current: usize, max: usize, ) -> Self

Create a resource exhausted error with usage info

Source

pub const fn is_retryable(&self) -> bool

Check if this error is retryable

Source

pub const fn is_fatal(&self) -> bool

Check if this error should cause server shutdown

Source

pub const fn error_code(&self) -> i32

Get error code for JSON-RPC responses

Trait Implementations§

Source§

impl Debug for ServerError

Source§

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

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

impl Display for ServerError

Source§

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

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

impl Error for ServerError

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<Error>> for ServerError

Source§

fn from(core_error: Box<Error>) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ServerError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for ServerError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<RegistryError> for ServerError

Source§

fn from(source: RegistryError) -> Self

Converts to this type from the input type.
Source§

impl From<TransportError> for ServerError

Source§

fn from(source: TransportError) -> 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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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, 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,