#[non_exhaustive]pub enum ToolError {
InvalidInput(String),
HostBlocked {
host: String,
},
UnsupportedScheme {
scheme: String,
},
MethodBlocked {
method: String,
},
BodyTooLarge {
limit_bytes: usize,
},
Network {
message: String,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Config {
message: String,
source: Option<Box<dyn Error + Send + Sync + 'static>>,
},
Calculator(String),
Serde(Error),
}Expand description
Tool-layer failures.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidInput(String)
Input did not match the tool’s input_schema.
HostBlocked
Host blocked by the configured allowlist.
UnsupportedScheme
URL scheme was not http or https.
MethodBlocked
HTTP method blocked by the configured method allowlist.
BodyTooLarge
Response body exceeded the configured cap.
Network
Network / HTTP failure. Carries the underlying transport error
as the source so callers see the full chain via
std::error::Error::source.
Fields
Config
Configuration error (malformed allowlist pattern, etc.). Carries the parse / validation source when the misconfiguration was detected via a typed error.
Fields
Calculator(String)
Calculator parser rejected the input expression.
Serde(Error)
JSON encode/decode failure.
Implementations§
Source§impl ToolError
impl ToolError
Sourcepub fn network<E>(source: E) -> Self
pub fn network<E>(source: E) -> Self
Wrap any transport error as a ToolError::Network preserving
the source chain.
Sourcepub fn network_msg(message: impl Into<String>) -> Self
pub fn network_msg(message: impl Into<String>) -> Self
Construct a ToolError::Network from a bare message
(timeout, body cap exceeded, …).
Sourcepub fn config<E>(source: E) -> Self
pub fn config<E>(source: E) -> Self
Wrap a parse/validation error as a ToolError::Config
preserving the source chain.
Sourcepub fn config_msg(message: impl Into<String>) -> Self
pub fn config_msg(message: impl Into<String>) -> Self
Construct a ToolError::Config from a bare message.
Trait Implementations§
Source§impl Error for ToolError
impl Error for ToolError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
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
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