#[derive(Debug, thiserror::Error)]
#[error("{message}")]
pub struct ToolFailure {
message: String,
}
impl ToolFailure {
#[must_use]
pub fn message(&self) -> &str {
&self.message
}
#[must_use]
pub fn invalid_input(reason: impl Into<String>) -> Self {
Self {
message: format!("Invalid ChromaFrame MCP input: {}", reason.into()),
}
}
#[must_use]
pub fn sdk(reason: impl Into<String>) -> Self {
Self {
message: format!("ChromaFrame SDK flow failed: {}", reason.into()),
}
}
#[must_use]
pub fn image_read_failed() -> Self {
Self {
message: "ChromaFrame image intake failed before measurement. Verify the local image path and permissions.".to_string(),
}
}
}