pub enum McpError {
Core(Error),
Protocol(String),
ToolExecution {
tool_name: String,
message: String,
context: Option<ErrorContext>,
},
Resource {
resource_type: String,
message: String,
},
Prompt {
prompt_name: String,
message: String,
},
Cancelled {
operation: String,
reason: Option<String>,
},
Timeout {
operation: String,
timeout_ms: u64,
},
RateLimit {
operation: String,
retry_after_ms: u64,
},
}
Expand description
Enhanced error type for MCP operations
Variants§
Core(Error)
Core codeprism error
Protocol(String)
JSON-RPC protocol error
ToolExecution
Tool execution error
Resource
Resource operation error
Prompt
Prompt generation error
Cancelled
Cancellation error
Timeout
Timeout error
RateLimit
Rate limiting error
Implementations§
Source§impl McpError
impl McpError
Sourcepub fn severity(&self) -> ErrorSeverity
pub fn severity(&self) -> ErrorSeverity
Get the severity level of this error
Sourcepub fn recovery_strategy(&self) -> RecoveryStrategy
pub fn recovery_strategy(&self) -> RecoveryStrategy
Get the recovery strategy for this error
Sourcepub fn should_retry(&self) -> bool
pub fn should_retry(&self) -> bool
Check if this error should trigger a retry
Sourcepub fn json_rpc_code(&self) -> i32
pub fn json_rpc_code(&self) -> i32
Get JSON-RPC error code
Sourcepub fn error_type_name(&self) -> &'static str
pub fn error_type_name(&self) -> &'static str
Get error type name as string for serialization
Sourcepub fn to_json_rpc_error(&self) -> JsonRpcError
pub fn to_json_rpc_error(&self) -> JsonRpcError
Convert to JSON-RPC error
Trait Implementations§
Source§impl Error for McpError
impl Error for McpError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
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
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for McpError
impl !RefUnwindSafe for McpError
impl Send for McpError
impl Sync for McpError
impl Unpin for McpError
impl !UnwindSafe for McpError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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