pub enum ToolError {
ExecutionFailed {
message: String,
retryable: bool,
},
NotFound(String),
ModelRetry(String),
ApprovalRequired {
tool_name: String,
args: Value,
},
CallDeferred {
tool_name: String,
args: Value,
},
Timeout(Duration),
ValidationFailed {
tool_name: String,
errors: Vec<ValidationError>,
},
Cancelled,
ToolReturnedError(String),
Json(Error),
Other(Error),
}Expand description
Errors that can occur during tool execution.
Variants§
ExecutionFailed
Tool execution failed.
NotFound(String)
Tool not found in registry.
ModelRetry(String)
Model should retry with different arguments.
ApprovalRequired
Tool requires approval before execution.
Fields
CallDeferred
Tool call was deferred for later execution.
Timeout(Duration)
Tool execution timed out.
ValidationFailed
Tool argument validation failed.
Cancelled
Tool was cancelled.
ToolReturnedError(String)
Tool returned an error result.
Json(Error)
JSON serialization/deserialization error.
Other(Error)
Other errors.
Implementations§
Source§impl ToolError
impl ToolError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is retryable.
Sourcepub fn execution_failed(msg: impl Into<String>) -> Self
pub fn execution_failed(msg: impl Into<String>) -> Self
Create a non-retryable execution failure.
Sourcepub fn validation_failed(
tool_name: impl Into<String>,
errors: Vec<ValidationError>,
) -> Self
pub fn validation_failed( tool_name: impl Into<String>, errors: Vec<ValidationError>, ) -> Self
Create a validation failed error with multiple issues.
Sourcepub fn validation_error(
tool_name: impl Into<String>,
field: Option<String>,
message: impl Into<String>,
) -> Self
pub fn validation_error( tool_name: impl Into<String>, field: Option<String>, message: impl Into<String>, ) -> Self
Create a validation failed error with a single issue.
Sourcepub fn invalid_arguments(
tool_name: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn invalid_arguments( tool_name: impl Into<String>, message: impl Into<String>, ) -> Self
Create an invalid arguments error for argument parsing.
Sourcepub fn model_retry(msg: impl Into<String>) -> Self
pub fn model_retry(msg: impl Into<String>) -> Self
Create a model retry error.
Sourcepub fn approval_required(tool_name: impl Into<String>, args: Value) -> Self
pub fn approval_required(tool_name: impl Into<String>, args: Value) -> Self
Create an approval required error.
Sourcepub fn call_deferred(tool_name: impl Into<String>, args: Value) -> Self
pub fn call_deferred(tool_name: impl Into<String>, args: Value) -> Self
Create a call deferred error.
Sourcepub fn is_approval_required(&self) -> bool
pub fn is_approval_required(&self) -> bool
Check if this is an approval required error.
Sourcepub fn is_call_deferred(&self) -> bool
pub fn is_call_deferred(&self) -> bool
Check if this is a call deferred error.
Sourcepub fn is_model_retry(&self) -> bool
pub fn is_model_retry(&self) -> bool
Check if this is a model retry error.