pub enum ToolError {
InvalidInput {
tool: String,
source: Error,
},
Handler {
tool: String,
source: HandlerError,
},
MissingIdempotencyKey {
tool: String,
path: String,
detail: String,
},
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.ToolError::MissingIdempotencyKeymeans the operator declared which input field identifies this tool’s calls and the call does not carry it. The tool was not called, and it will not be called unkeyed. LikeInvalidInputthis is the arguments being wrong, so the loop feeds it back to the model rather than retrying it.
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.
MissingIdempotencyKey
The tool has a declared idempotency key path and this call’s input does not yield a key from it. Nothing ran.
See IdempotencyPath::derive for what
counts as a key and why falling back to an unkeyed call is not an option
here.
Fields
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