pub struct ToolError { /* private fields */ }Expand description
Public-safe typed failure returned by a tool implementation or adapter.
external_effect is deliberately independent of failure category. The one
exception is an exact invariant: Unknown is paired with
FailureCategory::AmbiguousExternalOutcome and therefore with
RetryAdvice::ReconcileFirst.
Implementations§
Source§impl ToolError
impl ToolError
Sourcepub fn new(
failure: Failure,
phase: ToolErrorPhase,
external_effect: ToolExternalEffect,
provenance: ToolErrorProvenance,
) -> Result<Self, ToolErrorBuildError>
pub fn new( failure: Failure, phase: ToolErrorPhase, external_effect: ToolExternalEffect, provenance: ToolErrorProvenance, ) -> Result<Self, ToolErrorBuildError>
Constructs a failure while enforcing phase/effect/ambiguity invariants.
§Errors
Returns ToolErrorBuildError when effect evidence contradicts the
failure category or claims an impossible preparation/result phase.
Sourcepub fn with_recovery_handle(
self,
recovery_handle: ToolRecoveryHandle,
) -> Result<Self, ToolErrorBuildError>
pub fn with_recovery_handle( self, recovery_handle: ToolRecoveryHandle, ) -> Result<Self, ToolErrorBuildError>
Attaches the exact provider operation needed to reconcile an unknown external outcome without replaying the business request.
§Errors
A recovery handle is accepted only with explicit Unknown effect
evidence; known failures and successes must not carry one.
Sourcepub fn validate_for(
&self,
context: &ToolContext,
descriptor: &ToolDescriptor,
) -> Result<(), ToolErrorValidationError>
pub fn validate_for( &self, context: &ToolContext, descriptor: &ToolDescriptor, ) -> Result<(), ToolErrorValidationError>
Revalidates invocation, tool identity, risk, and retry safety.
§Errors
Returns ToolErrorValidationError when public evidence does not belong
to the exact context/descriptor or would permit an unsafe repeated write.
Sourcepub fn into_failure(self) -> Failure
pub fn into_failure(self) -> Failure
Consumes this value and returns the common failure occurrence.
Sourcepub const fn phase(&self) -> ToolErrorPhase
pub const fn phase(&self) -> ToolErrorPhase
Returns the failed boundary stage.
Sourcepub const fn external_effect(&self) -> ToolExternalEffect
pub const fn external_effect(&self) -> ToolExternalEffect
Returns authoritative or explicitly unknown external-effect evidence.
Sourcepub const fn provenance(&self) -> &ToolErrorProvenance
pub const fn provenance(&self) -> &ToolErrorProvenance
Returns stable invocation correlation evidence.
Sourcepub const fn recovery_handle(&self) -> Option<&ToolRecoveryHandle>
pub const fn recovery_handle(&self) -> Option<&ToolRecoveryHandle>
Returns the durable provider operation handle when reconciliation can target a known remote operation directly.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolError
impl<'de> Deserialize<'de> for ToolError
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Error for ToolError
impl Error for ToolError
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl JsonSchema for ToolError
impl JsonSchema for ToolError
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more