pub struct ToolError {
pub code: ErrorCode,
pub message: String,
pub field: Option<String>,
pub details: Option<String>,
pub blocked_by: Option<Vec<String>>,
pub suggestion: Option<String>,
}Expand description
Structured error for tool responses.
Fields§
§code: ErrorCode§message: String§field: Option<String>§details: Option<String>§blocked_by: Option<Vec<String>>§suggestion: Option<String>Implementations§
Source§impl ToolError
impl ToolError
pub fn new(code: ErrorCode, message: impl Into<String>) -> Self
pub fn with_field(self, field: impl Into<String>) -> Self
pub fn with_details(self, details: impl Into<String>) -> Self
pub fn with_blocked_by(self, blocked_by: Vec<String>) -> Self
pub fn with_suggestion(self, suggestion: impl Into<String>) -> Self
pub fn missing_field(field: &str) -> Self
pub fn invalid_value(field: &str, reason: &str) -> Self
pub fn agent_not_found(agent_id: &str) -> Self
pub fn task_not_found(task_id: &str) -> Self
pub fn lock_conflict(resource: &str, held_by: &str) -> Self
pub fn already_claimed(task_id: &str, owner: &str) -> Self
pub fn not_owner(task_id: &str, agent_id: &str) -> Self
pub fn dependency_cycle(blocker: &str, blocked: &str) -> Self
pub fn tag_mismatch(missing: &str) -> Self
pub fn deps_not_satisfied(blockers: &[String]) -> Self
pub fn gates_not_satisfied(status: &str, gates: &[String]) -> Self
pub fn invalid_path(path: &str, reason: &str) -> Self
pub fn prefix_not_lowercase(prefix: &str) -> Self
pub fn unknown_prefix(prefix: &str) -> Self
pub fn sandbox_escape(path: &str, root: &str) -> Self
pub fn database(err: impl Display) -> Self
pub fn internal(err: impl Display) -> Self
pub fn unknown_tool(name: &str) -> Self
Trait Implementations§
Source§impl Error for ToolError
impl Error for ToolError
1.30.0 · 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 Freeze for ToolError
impl RefUnwindSafe for ToolError
impl Send for ToolError
impl Sync for ToolError
impl Unpin for ToolError
impl UnsafeUnpin for ToolError
impl UnwindSafe 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
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 more