pub enum McpError {
Rpc {
code: i64,
message: String,
data: Option<Value>,
},
Closed(String),
Timeout(u64),
Aborted,
Http {
status: u16,
message: String,
},
AuthRequired {
challenge: Option<String>,
},
SessionExpired,
SignInRequired,
Network(String),
Other(String),
}Expand description
Why an MCP request or connection failed. Messages match pi-mcp’s.
Variants§
Rpc
The server answered with a JSON-RPC error, or sent something invalid.
Fields
Closed(String)
The connection is closed or not open.
Timeout(u64)
No response within the timeout.
Aborted
The caller cancelled the request.
Http
An HTTP request failed with a status.
AuthRequired
The server answered 401.
SessionExpired
The server no longer knows the session (404 with a session id).
SignInRequired
The stored OAuth credentials cannot be used or refreshed, so the user has to sign in (again).
Network(String)
The request could not reach the server.
Other(String)
Anything else, such as a server process that could not start.
Implementations§
Trait Implementations§
Source§impl Error for McpError
impl Error for McpError
1.30.0 · 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()
impl StructuralPartialEq for McpError
Auto Trait Implementations§
impl Forget for McpError
impl Freeze for McpError
impl RefUnwindSafe for McpError
impl Send for McpError
impl Sync for McpError
impl Unpin for McpError
impl UnsafeUnpin 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