tool_parser/
errors.rs

1use thiserror::Error;
2
3/// Result type for tool parser operations
4pub type ParserResult<T> = Result<T, ParserError>;
5
6/// Errors that can occur during tool parsing
7#[derive(Debug, Error)]
8pub enum ParserError {
9    #[error("Parsing failed: {0}")]
10    ParsingFailed(String),
11
12    #[error("Model not supported: {0}")]
13    ModelNotSupported(String),
14
15    #[error("Parse depth exceeded: max {0}")]
16    DepthExceeded(usize),
17
18    #[error("Invalid JSON: {0}")]
19    JsonError(#[from] serde_json::Error),
20
21    #[error("Regex error: {0}")]
22    RegexError(#[from] regex::Error),
23
24    #[error("Incomplete tool call")]
25    Incomplete,
26
27    #[error("Invalid tool name: {0}")]
28    InvalidToolName(String),
29
30    #[error("Token not found: {0}")]
31    TokenNotFound(String),
32}