ErrorExt

Trait ErrorExt 

Source
pub trait ErrorExt<T> {
    // Required methods
    fn with_mcp_error(
        self,
        kind: ErrorKind,
        message: impl Into<String>,
    ) -> Result<T>;
    fn with_internal_error(self, message: impl Into<String>) -> Result<T>;
}
Expand description

Extension trait for adding MCP error context to other error types

Required Methods§

Source

fn with_mcp_error( self, kind: ErrorKind, message: impl Into<String>, ) -> Result<T>

Convert any error to an MCP error with the specified kind

§Errors

Returns an Error with the specified kind and message, preserving the source error context.

Source

fn with_internal_error(self, message: impl Into<String>) -> Result<T>

Convert any error to an MCP internal error

§Errors

Returns an Error with internal error kind and the provided message.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, E> ErrorExt<T> for Result<T, E>
where E: Error + Send + Sync + 'static,

Source§

fn with_mcp_error( self, kind: ErrorKind, message: impl Into<String>, ) -> Result<T>

Source§

fn with_internal_error(self, message: impl Into<String>) -> Result<T>

Implementors§