1. optimize the readme in root 2. add example Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
24 lines
439 B
Rust
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(),
|
|
}
|
|
}
|
|
}
|