#[non_exhaustive]pub enum ToolErrorKind {
VersionConflict {
path: String,
expected: String,
actual: Option<String>,
},
RemoteGitConflict {
code: String,
message: String,
},
NotFound {
path: String,
},
InvalidArgument {
message: String,
},
Unsupported {
message: String,
},
Timeout {
op: String,
duration_ms: u64,
},
}Expand description
Structured discriminant for tool failures.
This is the SDK-facing counterpart of WorkspaceError
(and any future typed error sources). The Rust trait surface returns
typed enums; this struct is what survives the trip through
ToolOutput → ToolResult → ToolCallResult → SDK boundary so JS /
Python callers can do match on the kind instead of regex-matching
the human-readable output string.
Serializes to JSON with a type discriminator, e.g.:
{ "type": "version_conflict", "path": "doc.md", "expected": "etag-1", "actual": "etag-2" }#[non_exhaustive] so adding a new kind is a minor-version change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
VersionConflict
Compare-and-swap write rejected by the backend because the file
changed since the caller read it. Originates from
WorkspaceError::VersionConflict on the S3 / future versioning
backends.
RemoteGitConflict
Remote git server returned a typed 409 / 422 conflict code such
as BRANCH_EXISTS or WORKING_TREE_DIRTY.
NotFound
Operation referenced a path that does not exist.
InvalidArgument
Caller passed an argument the tool / backend cannot honour (malformed pattern, parent-traversal path, …).
Unsupported
The backend explicitly does not support this operation (e.g. worktree on a remote-git workspace).
Timeout
The operation’s outer timeout fired before the backend responded.
Implementations§
Source§impl ToolErrorKind
impl ToolErrorKind
Sourcepub fn from_workspace_error(err: &WorkspaceError) -> Option<Self>
pub fn from_workspace_error(err: &WorkspaceError) -> Option<Self>
Map a WorkspaceError into the
corresponding SDK-visible kind. Backend variants that don’t fit a
dedicated ToolErrorKind (currently Backend(_)) return None;
the caller then surfaces only the human-readable message.
Trait Implementations§
Source§impl Clone for ToolErrorKind
impl Clone for ToolErrorKind
Source§fn clone(&self) -> ToolErrorKind
fn clone(&self) -> ToolErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToolErrorKind
impl Debug for ToolErrorKind
Source§impl<'de> Deserialize<'de> for ToolErrorKind
impl<'de> Deserialize<'de> for ToolErrorKind
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 PartialEq for ToolErrorKind
impl PartialEq for ToolErrorKind
Source§fn eq(&self, other: &ToolErrorKind) -> bool
fn eq(&self, other: &ToolErrorKind) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ToolErrorKind
impl Serialize for ToolErrorKind
impl Eq for ToolErrorKind
impl StructuralPartialEq for ToolErrorKind
Auto Trait Implementations§
impl Freeze for ToolErrorKind
impl RefUnwindSafe for ToolErrorKind
impl Send for ToolErrorKind
impl Sync for ToolErrorKind
impl Unpin for ToolErrorKind
impl UnsafeUnpin for ToolErrorKind
impl UnwindSafe for ToolErrorKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<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>
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>
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