pub enum CliError {
Config {
detail: String,
file: Option<String>,
suggestion: String,
},
Contract {
detail: String,
diagnostics: Vec<String>,
},
Link {
detail: String,
diagnostics: Vec<String>,
},
Runtime {
detail: String,
context: Option<String>,
},
Packaging {
detail: String,
suggestion: String,
},
Security {
detail: String,
suggestion: String,
},
Environment {
detail: String,
fix: String,
},
Io {
detail: String,
path: Option<String>,
},
Internal {
detail: String,
},
NotImplemented {
command: String,
},
}Expand description
Top-level CLI error type.
§Invariants
- Every variant maps to a specific exit code.
- Every variant carries enough context for a four-part error message.
§Error codes (per Doc 10 C07-2, Doc 09 G-08)
- E0001–E0099: General CLI errors
- E0100–E0199: Contract errors
- E0200–E0299: Linking errors
- E0300–E0399: Resource errors
- E0400–E0499: Reactor errors
- E0500–E0599: Security errors
- E0600–E0699: Packaging errors
- E0700–E0799: Configuration errors
Variants§
Config
Configuration file not found or invalid.
Fields
Contract
WIT contract validation failure.
Link
Pipeline linking/composition failure.
Runtime
Runtime execution failure.
Packaging
Packaging or publish failure.
Security
Security/capability failure.
Environment
Environment issue (missing tool, wrong version).
Io
Filesystem error (can’t create directory, can’t write file).
Internal
Generic internal error (should not normally reach users).
NotImplemented
Command not yet implemented.
Implementations§
Source§impl CliError
impl CliError
Sourcepub fn exit_code(&self) -> i32
pub fn exit_code(&self) -> i32
Map this error to a process exit code.
- Returns 1 for command failures (validation, runtime, packaging).
- Returns 2 for usage errors (bad config, missing files).
- Returns 3 for environment errors (missing tools).
Sourcepub fn render(&self, ctx: &OutputContext)
pub fn render(&self, ctx: &OutputContext)
Render this error to the terminal.
COLD PATH — called at most once per invocation.
Trait Implementations§
Source§impl From<TorvynError> for CliError
impl From<TorvynError> for CliError
Source§fn from(err: TorvynError) -> Self
fn from(err: TorvynError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for CliError
impl RefUnwindSafe for CliError
impl Send for CliError
impl Sync for CliError
impl Unpin for CliError
impl UnsafeUnpin for CliError
impl UnwindSafe for CliError
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
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>
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 more