pub struct UnifiedToolError {
pub kind: UnifiedErrorKind,
pub severity: ErrorSeverity,
pub user_message: String,
pub debug_context: Option<DebugContext>,
pub source: Option<Error>,
}Expand description
Unified tool error envelope
Fields§
§kind: UnifiedErrorKindError classification
severity: ErrorSeveritySeverity level
user_message: StringUser-facing message (safe to display)
debug_context: Option<DebugContext>Debug context (tool name, args, etc.)
source: Option<Error>Original error (for chaining)
Implementations§
Source§impl UnifiedToolError
impl UnifiedToolError
Sourcepub fn new(kind: UnifiedErrorKind, user_message: impl Into<String>) -> Self
pub fn new(kind: UnifiedErrorKind, user_message: impl Into<String>) -> Self
Create a new unified error
Sourcepub fn with_context(self, ctx: DebugContext) -> Self
pub fn with_context(self, ctx: DebugContext) -> Self
Add debug context
Sourcepub fn with_source(self, err: Error) -> Self
pub fn with_source(self, err: Error) -> Self
Add source error
Sourcepub fn with_tool_name(self, name: &str) -> Self
pub fn with_tool_name(self, name: &str) -> Self
Add tool name to debug context
Sourcepub fn with_invocation_id(self, id: ToolInvocationId) -> Self
pub fn with_invocation_id(self, id: ToolInvocationId) -> Self
Add invocation ID to debug context
Sourcepub fn with_duration(self, duration: Duration) -> Self
pub fn with_duration(self, duration: Duration) -> Self
Add duration metadata
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if error is retryable
Sourcepub fn is_llm_mistake(&self) -> bool
pub fn is_llm_mistake(&self) -> bool
Check if this is an LLM argument error (should not count toward circuit breaker)
Sourcepub fn category(&self) -> ErrorCategory
pub fn category(&self) -> ErrorCategory
Return the canonical VT Code error category for this tool error.
Trait Implementations§
Source§impl Debug for UnifiedToolError
impl Debug for UnifiedToolError
Source§impl Display for UnifiedToolError
impl Display for UnifiedToolError
Source§impl Error for UnifiedToolError
impl Error for UnifiedToolError
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()
Source§impl From<ToolCallError> for UnifiedToolError
Convert from handlers::ToolCallError
impl From<ToolCallError> for UnifiedToolError
Convert from handlers::ToolCallError
Source§fn from(err: ToolCallError) -> Self
fn from(err: ToolCallError) -> Self
Converts to this type from the input type.
Source§impl From<ToolError> for UnifiedToolError
Convert from handlers::sandboxing::ToolError
impl From<ToolError> for UnifiedToolError
Convert from handlers::sandboxing::ToolError
Source§impl From<UnifiedToolError> for VtCodeError
impl From<UnifiedToolError> for VtCodeError
Source§fn from(err: UnifiedToolError) -> Self
fn from(err: UnifiedToolError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Forget for UnifiedToolError
impl Freeze for UnifiedToolError
impl Move for UnifiedToolError
impl RefUnwindSafe for UnifiedToolError
impl Send for UnifiedToolError
impl Sync for UnifiedToolError
impl Unpin for UnifiedToolError
impl UnsafeUnpin for UnifiedToolError
impl UnwindSafe for UnifiedToolError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> ErrorExt for T
impl<T> ErrorExt for T
Source§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> 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> 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,
impl<T> PtyHandle for Twhere
T: Send,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more