Skip to main content

synwire_core/error/
tool.rs

1//! Errors specific to tool invocations.
2
3/// Errors specific to tool invocations.
4#[derive(Debug, thiserror::Error)]
5#[non_exhaustive]
6pub enum ToolError {
7    /// Tool invocation failed.
8    #[error("tool invocation failed: {message}")]
9    InvocationFailed {
10        /// Error message.
11        message: String,
12    },
13    /// Tool input validation failed.
14    #[error("tool input validation failed: {message}")]
15    ValidationFailed {
16        /// Error message.
17        message: String,
18    },
19    /// Tool not found.
20    #[error("tool not found: {name}")]
21    NotFound {
22        /// Tool name.
23        name: String,
24    },
25    /// Invalid tool name.
26    #[error("invalid tool name '{name}': {reason}")]
27    InvalidName {
28        /// The invalid name.
29        name: String,
30        /// Reason it is invalid.
31        reason: String,
32    },
33    /// Path traversal attempt detected.
34    #[error("path traversal detected: {path}")]
35    PathTraversal {
36        /// The offending path.
37        path: String,
38    },
39    /// Tool execution timed out.
40    #[error("tool execution timed out")]
41    Timeout,
42    /// Other tool error.
43    #[error("tool error: {message}")]
44    Other {
45        /// Error message.
46        message: String,
47    },
48}