rust-sdk/examples/simple-chat-client/src/error.rs
jokemanfire 2125698fdc
docs: add a simple chat client for example (#119)
1. optimize the readme in root
2. add example

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2025-04-10 16:52:25 +08:00

24 lines
439 B
Rust

use std::fmt;
use serde::Serialize;
#[derive(Debug, Serialize)]
pub struct McpError {
pub message: String,
}
impl fmt::Display for McpError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.message)
}
}
impl std::error::Error for McpError {}
impl McpError {
pub fn new(message: impl ToString) -> Self {
Self {
message: message.to_string(),
}
}
}