pub struct RpcError {
pub code: i64,
pub data: Option<Value>,
pub message: String,
}Expand description
RpcError
JSON schema
{
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"description": "The error type that occurred.",
"type": "integer"
},
"data": {
"description": "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)."
},
"message": {
"description": "A short description of the error. The message SHOULD be limited to a concise single sentence.",
"type": "string"
}
}
}Fields§
§code: i64The error type that occurred.
data: Option<Value>Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
message: StringA short description of the error. The message SHOULD be limited to a concise single sentence.
Implementations§
Source§impl RpcError
impl RpcError
pub fn new( error_code: RpcErrorCodes, message: String, data: Option<Value>, ) -> RpcError
pub fn method_not_found() -> RpcError
pub fn invalid_params() -> RpcError
pub fn invalid_request() -> RpcError
pub fn internal_error() -> RpcError
pub fn parse_error() -> RpcError
pub fn with_message<T>(self, message: T) -> RpcError
pub fn with_data(self, data: Option<Value>) -> RpcError
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RpcError
impl<'de> Deserialize<'de> for RpcError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RpcError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RpcError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Error for RpcError
impl Error for RpcError
Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
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
Source§impl From<CallToolError> for RpcError
Converts a CallToolError into a RpcError.
impl From<CallToolError> for RpcError
Converts a CallToolError into a RpcError.
The conversion creates an internal error variant of RpcError
and attaches the string representation of the original CallToolError as a message.
Source§fn from(value: CallToolError) -> RpcError
fn from(value: CallToolError) -> RpcError
Converts to this type from the input type.
Source§impl From<MissingRequiredClientCapabilityError> for RpcError
impl From<MissingRequiredClientCapabilityError> for RpcError
Source§fn from(value: MissingRequiredClientCapabilityError) -> RpcError
fn from(value: MissingRequiredClientCapabilityError) -> RpcError
Converts to this type from the input type.
Source§impl From<RpcError> for TransportError
impl From<RpcError> for TransportError
Source§fn from(source: RpcError) -> TransportError
fn from(source: RpcError) -> TransportError
Converts to this type from the input type.
Source§impl From<RpcError> for MessageFromServer
impl From<RpcError> for MessageFromServer
Source§fn from(value: RpcError) -> MessageFromServer
fn from(value: RpcError) -> MessageFromServer
Converts to this type from the input type.
Source§impl From<RpcError> for MessageFromClient
impl From<RpcError> for MessageFromClient
Source§fn from(value: RpcError) -> MessageFromClient
fn from(value: RpcError) -> MessageFromClient
Converts to this type from the input type.
Source§impl From<RpcError> for McpSdkError
impl From<RpcError> for McpSdkError
Source§impl From<UnsupportedProtocolVersionError> for RpcError
impl From<UnsupportedProtocolVersionError> for RpcError
Source§fn from(value: UnsupportedProtocolVersionError) -> RpcError
fn from(value: UnsupportedProtocolVersionError) -> RpcError
Converts to this type from the input type.
Source§impl Serialize for RpcError
impl Serialize for RpcError
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for RpcError
impl RefUnwindSafe for RpcError
impl Send for RpcError
impl Sync for RpcError
impl Unpin for RpcError
impl UnsafeUnpin for RpcError
impl UnwindSafe for RpcError
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