Skip to main content

ToolErrorKind

Enum ToolErrorKind 

Source
pub enum ToolErrorKind {
    NotFound,
    ToolUnavailable,
    Timeout,
    Network,
    PermissionDenied,
    InvalidInput,
    RateLimited,
    LoopDetected,
    Internal,
    External {
        source: &'static str,
    },
}
Expand description

工具执行错误的分类。

Copy 约束保留——所有变体均为 Copy 类型。

Variants§

§

NotFound

工具未找到(静态目录中从未存在)

§

ToolUnavailable

工具不可用(动态目录中曾存在但当前刷新后消失)

§

Timeout

工具执行超时

§

Network

网络相关错误

§

PermissionDenied

权限不足

§

InvalidInput

输入参数无效

§

RateLimited

被限流

§

LoopDetected

检测到循环调用

§

Internal

内部错误(兜底)

§

External

外部业务错误(由用户代码抛出,自动桥接)

source 为原始错误类型的 type_name,用于可观测性。

Fields

§source: &'static str

Implementations§

Source§

impl ToolErrorKind

Source

pub fn is_retryable(self) -> bool

判断该错误是否属于基础设施层面的瞬态故障(Transient Failure)。

可重试(原地静默重试):

  • Timeout / Network / RateLimited — 网络抖动、服务端过载
  • ToolUnavailable — 动态目录瞬态不可用(MCP 重启等)

不可重试(立即弹回 LLM 修复层):

  • InvalidInput — 参数错了就是错了
  • NotFound — 工具不存在,重试也没用
  • PermissionDenied — 权限不会自动恢复
  • External — 用户业务错误,框架不应猜测
  • LoopDetected — 循环检测,重试无意义
  • Internal — 内部错误,重试无意义

Trait Implementations§

Source§

impl Clone for ToolErrorKind

Source§

fn clone(&self) -> ToolErrorKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ToolErrorKind

Source§

impl Debug for ToolErrorKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ToolErrorKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for ToolErrorKind

Source§

impl PartialEq for ToolErrorKind

Source§

fn eq(&self, other: &ToolErrorKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ToolErrorKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.