pub enum CodingError {
File(FileError),
Bash(BashError),
WebFetch(WebFetchError),
WebSearch(WebSearchError),
Lsp(LspError),
NotConfigured(&'static str),
EmptyFilePath(EmptyFilePathError),
NotReadBeforeOverwrite(String),
NotReadBeforeEdit(String),
ExistsCheckFailed {
path: String,
source: Error,
},
}Expand description
Error types for all coding tool operations.
CodingError is the top-level enum returned by the tools exposed by CodingMcp. Each variant wraps a more specific error type.
§Variants
File– File read, write, or edit failures (FileError).Bash– Shell command execution failures (BashError).WebFetch– URL fetch failures (WebFetchError).WebSearch– Web search API failures (WebSearchError).Lsp– LSP code-intelligence tool failures (LspError).NotConfigured– A tool was called that requires configuration not present (e.g. web search without a Brave API key).EmptyFilePath– A required file-path argument was empty.NotReadBeforeOverwrite/NotReadBeforeEdit– Read-before-overwrite/edit safety checks failed.ExistsCheckFailed– Failed to check whether the target file exists.
§Sub-error types
FileError–NotFound,ReadFailed,WriteFailed,CreateDirFailed,InvalidOffset,PatternNotFound,Io.BashError–Forbidden,TimeoutTooLarge,SpawnFailed.WebFetchError–InvalidUrl,RequestFailed,Timeout,ResponseTooLarge,ParseFailed.WebSearchError–InvalidQuery,ApiError,RateLimited,Timeout,ConfigError,ParseError.
Variants§
File(FileError)
File operation errors (read, write, edit)
Bash(BashError)
Bash command execution errors
WebFetch(WebFetchError)
Web fetch errors
WebSearch(WebSearchError)
Web search errors
Lsp(LspError)
LSP tool errors
NotConfigured(&'static str)
Tool not configured/available
EmptyFilePath(EmptyFilePathError)
A required file-path argument was empty
NotReadBeforeOverwrite(String)
An existing file must be read before it may be overwritten
NotReadBeforeEdit(String)
A file must be read before it may be edited
ExistsCheckFailed
Failed to check whether the target file exists
Trait Implementations§
Source§impl Debug for CodingError
impl Debug for CodingError
Source§impl Display for CodingError
impl Display for CodingError
Source§impl Error for CodingError
impl Error for CodingError
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<BashError> for CodingError
impl From<BashError> for CodingError
Source§impl From<EmptyFilePathError> for CodingError
impl From<EmptyFilePathError> for CodingError
Source§fn from(source: EmptyFilePathError) -> Self
fn from(source: EmptyFilePathError) -> Self
Converts to this type from the input type.
Source§impl From<FileError> for CodingError
impl From<FileError> for CodingError
Source§impl From<LspError> for CodingError
impl From<LspError> for CodingError
Source§impl From<WebFetchError> for CodingError
impl From<WebFetchError> for CodingError
Source§fn from(source: WebFetchError) -> Self
fn from(source: WebFetchError) -> Self
Converts to this type from the input type.
Source§impl From<WebSearchError> for CodingError
impl From<WebSearchError> for CodingError
Source§fn from(source: WebSearchError) -> Self
fn from(source: WebSearchError) -> Self
Converts to this type from the input type.
Source§impl IntoContents for CodingError
Renders the error as the text content of an errored MCP tool result.
impl IntoContents for CodingError
Renders the error as the text content of an errored MCP tool result.
fn into_contents(self) -> Vec<ContentBlock>
Auto Trait Implementations§
impl !RefUnwindSafe for CodingError
impl !UnwindSafe for CodingError
impl Freeze for CodingError
impl Send for CodingError
impl Sync for CodingError
impl Unpin for CodingError
impl UnsafeUnpin for CodingError
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> 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> IntoCallToolResult for Twhere
T: IntoContents,
impl<T> IntoCallToolResult for Twhere
T: IntoContents,
fn into_call_tool_result(self) -> Result<CallToolResponse, ErrorData>
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 moreCreates a shared type from an unshared type.