#[non_exhaustive]pub enum ToolkitError {
Parse(Error),
MissingField(String),
Synth(String),
CodeMode(String),
Io(Error),
Secret {
name: String,
cause: String,
},
Validation(ConfigValidationError),
}Expand description
Errors surfaced by the pmcp-server-toolkit runtime.
The enum is #[non_exhaustive] — match callers must include a wildcard arm.
§Examples
use pmcp_server_toolkit::ToolkitError;
use std::error::Error;
// ToolkitError is a real `std::error::Error`, with a usable `Display` impl.
let err: ToolkitError = ToolkitError::MissingField("database.dsn".into());
assert_eq!(err.to_string(), "missing required config field: database.dsn");
// Implements `std::error::Error`, so it composes with `?` and `Box<dyn Error>`.
let boxed: Box<dyn Error + Send + Sync> = Box::new(err);
assert!(boxed.source().is_none());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Parse(Error)
TOML parse failure while loading a ServerConfig.
MissingField(String)
A required config field was absent during tool synthesis.
Synth(String)
[[tools]] synthesis failed (covers Phase 83 TKIT-07 failure modes).
CodeMode(String)
Code-mode wiring failed (covers Phase 83 TKIT-09 failure modes).
Io(Error)
Filesystem failure while reading a config or fixture.
Secret
Secret resolution failed (env var missing, AWS API error, etc.).
Carries the secret name and a descriptive cause string; the underlying
raw value is NEVER carried in this variant — only the lookup-key
metadata and the error context. This preserves the SecretValue
negative-trait invariants at the error path (review R5 + T-83-02-02).
Fields
Validation(ConfigValidationError)
Semantic validation of a parsed crate::config::ServerConfig failed.
Wraps a ConfigValidationError surfaced by
crate::config::ServerConfig::validate /
crate::config::ServerConfig::from_toml_strict_validated. Per Phase 83
review R8 this catches the empty-required-value trap that the
Default impls on sub-sections would otherwise hide behind silent
successes (e.g. server.name = "" if the [server] header is typo’d).
Trait Implementations§
Source§impl Debug for ToolkitError
impl Debug for ToolkitError
Source§impl Display for ToolkitError
impl Display for ToolkitError
Source§impl Error for ToolkitError
impl Error for ToolkitError
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()
Source§impl From<ConfigValidationError> for ToolkitError
impl From<ConfigValidationError> for ToolkitError
Source§fn from(source: ConfigValidationError) -> Self
fn from(source: ConfigValidationError) -> Self
Source§impl From<Error> for ToolkitError
impl From<Error> for ToolkitError
Auto Trait Implementations§
impl Freeze for ToolkitError
impl !RefUnwindSafe for ToolkitError
impl Send for ToolkitError
impl Sync for ToolkitError
impl Unpin for ToolkitError
impl UnsafeUnpin for ToolkitError
impl !UnwindSafe for ToolkitError
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