#[non_exhaustive]pub enum MktError {
ProviderNotFound {
provider: String,
available: String,
},
ApiError {
provider: String,
status: u16,
message: String,
retry_after: Option<u64>,
},
AuthError {
provider: String,
reason: String,
},
ConfigError(String),
RateLimited {
provider: String,
retry_after_secs: u64,
},
ValidationError {
field: String,
message: String,
},
NotSupported {
provider: String,
feature: String,
},
Http(Error),
Io(Error),
SerdeJson(Error),
Toml(Error),
Csv(Error),
}Expand description
The unified error type for the mkt workspace.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ProviderNotFound
The requested provider is not registered or not available.
Fields
ApiError
An API request returned an error response.
Fields
AuthError
Authentication failed for a provider.
Fields
ConfigError(String)
A configuration error occurred.
RateLimited
The provider’s rate limit has been exceeded.
Fields
ValidationError
A validation error on user input.
NotSupported
The provider does not support the requested feature.
Fields
Http(Error)
An HTTP transport error from reqwest.
Io(Error)
A filesystem I/O error.
SerdeJson(Error)
A JSON serialization/deserialization error.
Toml(Error)
A TOML parsing error.
Csv(Error)
A CSV writing error.
Implementations§
Source§impl MktError
impl MktError
Sourcepub fn not_supported(provider: &str, feature: &str) -> Self
pub fn not_supported(provider: &str, feature: &str) -> Self
Convenience constructor for NotSupported errors.
Sourcepub fn auth_error(provider: &str, reason: &str) -> Self
pub fn auth_error(provider: &str, reason: &str) -> Self
Convenience constructor for AuthError.
Sourcepub const fn exit_code(&self) -> u8
pub const fn exit_code(&self) -> u8
Process exit code for this error.
The contract is stable and documented in AGENTS.md so scripts and
coding agents can branch on it:
| Code | Meaning |
|---|---|
| 0 | success |
| 1 | unexpected error (I/O, transport, bug) |
| 2 | invalid input or configuration |
| 3 | authentication failed |
| 4 | resource or provider not found |
| 5 | rate limited (transient — retry) |
| 6 | feature not supported by the provider |
| 7 | provider API rejected the request |
Sourcepub const fn error_type(&self) -> &'static str
pub const fn error_type(&self) -> &'static str
Stable machine-readable error identifier (snake_case).
Emitted in structured error output so agents can match on the kind of failure without parsing human-readable messages.
Sourcepub const fn is_transient(&self) -> bool
pub const fn is_transient(&self) -> bool
Whether retrying the same request later may succeed.
Sourcepub fn suggestion(&self) -> Option<String>
pub fn suggestion(&self) -> Option<String>
A recovery hint for the user or agent, when one exists.
Trait Implementations§
Source§impl Error for MktError
impl Error for MktError
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()