#[non_exhaustive]pub enum McpxError {
Config(String),
Auth(String),
Rbac(String),
RateLimited(String),
RateLimitedFor {
message: String,
retry_after: Duration,
},
Io(Error),
Json(Error),
Toml(Error),
Tls(String),
Startup(String),
Metrics(String),
}Expand description
Generic MCP server error type.
Application crates should define their own error types and convert
from/into McpxError where needed.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Config(String)
Configuration parsing or validation failed.
Auth(String)
Authentication failed (bad/missing credential).
Rbac(String)
Authorization (RBAC) denied the request.
RateLimited(String)
Request was rejected by a rate limiter.
RateLimitedFor
Request was rejected by a rate limiter that knows the wait time.
Renders as HTTP 429 with a Retry-After header (RFC 9110
delta-seconds: the duration is rounded up to whole seconds,
minimum 1) and the message as a plain-text body. The legacy
RateLimited variant remains headerless.
Fields
Io(Error)
Underlying I/O error.
Json(Error)
JSON (de)serialization error.
Toml(Error)
TOML parse error (configuration loading).
Tls(String)
TLS configuration failure (certificate load, key parse, rustls config).
Startup(String)
Server startup failure (binding, listener, runtime initialization).
Metrics(String)
Metrics registration failure (e.g. Prometheus duplicate or invalid metric).
Trait Implementations§
Source§impl Error for McpxError
impl Error for McpxError
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()