pub enum ToolError {
NotFound {
name: String,
},
InvalidArguments {
tool: String,
reason: String,
},
ExecutionFailed {
tool: String,
message: String,
},
Timeout {
tool: String,
timeout_ms: u64,
},
Serialization(Error),
AuditFailed(String),
Unavailable {
name: String,
reason: String,
},
}Expand description
Error types for tool execution with precise variants for each failure mode.
§Example
use vex_llm::ToolError;
let err = ToolError::not_found("unknown_tool");
assert!(err.to_string().contains("unknown_tool"));Variants§
NotFound
Tool not found in registry
InvalidArguments
Invalid arguments provided to tool
ExecutionFailed
Tool execution failed
Timeout
Tool execution exceeded timeout
Serialization(Error)
JSON serialization/deserialization error
AuditFailed(String)
Audit logging failed (non-fatal, logged but doesn’t stop execution)
Tool is disabled or unavailable
Implementations§
Source§impl ToolError
impl ToolError
Sourcepub fn invalid_args(tool: impl Into<String>, reason: impl Into<String>) -> Self
pub fn invalid_args(tool: impl Into<String>, reason: impl Into<String>) -> Self
Create an InvalidArguments error with context
§Security Note
The reason should not contain raw user input to prevent information leakage
Sourcepub fn execution_failed(
tool: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn execution_failed( tool: impl Into<String>, message: impl Into<String>, ) -> Self
Create an ExecutionFailed error
§Security Note
The message should be sanitized before passing to this constructor
Create an Unavailable error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is recoverable (can retry)
Sourcepub fn should_audit(&self) -> bool
pub fn should_audit(&self) -> bool
Check if this error should be logged to audit trail
Trait Implementations§
Source§impl Error for ToolError
impl Error for ToolError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ToolError
impl !RefUnwindSafe for ToolError
impl Send for ToolError
impl Sync for ToolError
impl Unpin for ToolError
impl UnsafeUnpin for ToolError
impl !UnwindSafe for ToolError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoAnyhow for T
impl<T> IntoAnyhow for T
Source§fn into_anyhow(self) -> Error
fn into_anyhow(self) -> Error
Converts
self into an anyhow::Error.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.