spreadsheet_mcp/
errors.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
4#[error("{message}")]
5pub struct InvalidParamsError {
6 tool: &'static str,
7 message: String,
8 path: Option<String>,
9}
10
11impl InvalidParamsError {
12 pub fn new(tool: &'static str, message: impl Into<String>) -> Self {
13 Self {
14 tool,
15 message: message.into(),
16 path: None,
17 }
18 }
19
20 pub fn with_path(mut self, path: impl Into<String>) -> Self {
21 self.path = Some(path.into());
22 self
23 }
24
25 pub fn tool(&self) -> &'static str {
26 self.tool
27 }
28
29 pub fn message(&self) -> &str {
30 &self.message
31 }
32
33 pub fn path(&self) -> Option<&str> {
34 self.path.as_deref()
35 }
36}