pub enum ToolError {
InvalidInput {
tool: String,
source: Error,
},
Handler {
tool: String,
source: HandlerError,
},
OutputSerialization {
tool: String,
source: Error,
},
}Expand description
The error the type-erased dispatch layer
(DynTool::call_json) returns.
The variants are deliberately distinct so the runtime loop can route on them:
ToolError::InvalidInputmeans the JSON the model produced did not deserialize into the tool’sInputtype. The handler was not called. The loop feeds this back to the model to let it fix its arguments.ToolError::Handlermeans the handler ran and returned aHandlerError. This is a real execution failure, subject to the effect’s retry policy.ToolError::OutputSerializationmeans the handler succeeded but itsOutputvalue could not be serialized to JSON. This is an internal fault in the tool definition, not the model’s doing and not a retryable failure.
Variants§
InvalidInput
The model’s JSON input did not match the tool’s input schema. The handler was never invoked.
Fields
Handler
The handler ran and returned a failure.
OutputSerialization
The handler succeeded but its output could not be serialized to JSON.
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 !RefUnwindSafe for ToolError
impl !UnwindSafe for ToolError
impl Freeze for ToolError
impl Send for ToolError
impl Sync for ToolError
impl Unpin for ToolError
impl UnsafeUnpin 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