pub enum ToolError {
NotFound {
name: String,
},
Unavailable {
name: String,
reason: String,
},
InvalidArguments {
name: String,
reason: String,
},
ExecutionFailed {
message: String,
},
Timeout {
name: String,
timeout_ms: u64,
},
AccessDenied {
name: String,
},
Other(String),
CallbackPending {
tool_name: String,
args: Value,
},
}Expand description
Error returned by tool dispatch operations.
Variants§
NotFound
The requested tool was not found
The tool exists but is currently unavailable
InvalidArguments
The tool arguments failed validation
ExecutionFailed
The tool execution failed
Timeout
The tool execution timed out
AccessDenied
Tool access was denied by policy
Other(String)
A generic tool error with a message
CallbackPending
Tool call must be routed externally (callback pending)
This variant signals that a tool call cannot be handled internally and must be routed to an external handler. The payload contains serialized information about the pending tool call.
Implementations§
Source§impl ToolError
impl ToolError
pub fn error_code(&self) -> &'static str
pub fn to_error_payload(&self) -> Value
pub fn not_found(name: impl Into<String>) -> Self
pub fn invalid_arguments( name: impl Into<String>, reason: impl Into<String>, ) -> Self
pub fn execution_failed(message: impl Into<String>) -> Self
pub fn timeout(name: impl Into<String>, timeout_ms: u64) -> Self
pub fn access_denied(name: impl Into<String>) -> Self
pub fn other(message: impl Into<String>) -> Self
Sourcepub fn callback_pending(tool_name: impl Into<String>, args: Value) -> Self
pub fn callback_pending(tool_name: impl Into<String>, args: Value) -> Self
Create a callback pending error for external tool routing
Sourcepub fn is_callback_pending(&self) -> bool
pub fn is_callback_pending(&self) -> bool
Check if this is a callback pending error
Sourcepub fn as_callback_pending(&self) -> Option<(&str, &Value)>
pub fn as_callback_pending(&self) -> Option<(&str, &Value)>
Extract callback pending info if this is a CallbackPending error
Trait Implementations§
Source§impl Error for ToolError
impl Error for ToolError
1.30.0 · 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