pub struct McpErrorHandler { /* private fields */ }
Expand description
Comprehensive error handler for the MCP server
Implementations§
Source§impl McpErrorHandler
impl McpErrorHandler
Sourcepub async fn handle_error(&self, error: &McpError, operation: Option<&str>)
pub async fn handle_error(&self, error: &McpError, operation: Option<&str>)
Handle an error with comprehensive logging and metrics
Sourcepub async fn execute_with_recovery<F, Fut, T>(
&self,
operation_name: &str,
operation: F,
) -> McpResult<T>
pub async fn execute_with_recovery<F, Fut, T>( &self, operation_name: &str, operation: F, ) -> McpResult<T>
Execute an operation with comprehensive error handling and recovery
Sourcepub async fn execute_with_fallback<F, Fut, T, FB, FutB>(
&self,
operation_name: &str,
operation: F,
fallback: FB,
) -> T
pub async fn execute_with_fallback<F, Fut, T, FB, FutB>( &self, operation_name: &str, operation: F, fallback: FB, ) -> T
Execute operation with graceful degradation
Sourcepub fn get_health_status(&self) -> HealthCheckResult
pub fn get_health_status(&self) -> HealthCheckResult
Get health status
Sourcepub fn get_metrics(&self) -> MetricsSnapshot
pub fn get_metrics(&self) -> MetricsSnapshot
Get metrics snapshot
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Check if system is healthy
Sourcepub fn error_to_response(
&self,
error: &McpError,
request_id: Value,
) -> JsonRpcResponse
pub fn error_to_response( &self, error: &McpError, request_id: Value, ) -> JsonRpcResponse
Convert MCP error to JSON-RPC response
Sourcepub async fn handle_partial_operation<T>(
&self,
operation_name: &str,
total_items: usize,
processed_items: usize,
error: &McpError,
) -> McpResult<Option<T>>
pub async fn handle_partial_operation<T>( &self, operation_name: &str, total_items: usize, processed_items: usize, error: &McpError, ) -> McpResult<Option<T>>
Handle partial results for large operations
Sourcepub fn create_context(
&self,
request_id: Option<String>,
operation: Option<String>,
) -> ErrorContext
pub fn create_context( &self, request_id: Option<String>, operation: Option<String>, ) -> ErrorContext
Create error context for better tracing
Trait Implementations§
Auto Trait Implementations§
impl Freeze for McpErrorHandler
impl !RefUnwindSafe for McpErrorHandler
impl Send for McpErrorHandler
impl Sync for McpErrorHandler
impl Unpin for McpErrorHandler
impl !UnwindSafe for McpErrorHandler
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
Mutably borrows from an owned value. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more