pub enum RkError {
Usage(String),
NotFound {
kind: &'static str,
name: String,
},
Refused(String),
Refusal(Box<Diagnostic>),
Missing(Box<Diagnostic>),
CheckFailed(Box<Diagnostic>),
Subprocess(Box<Diagnostic>),
Io(Error),
Other(Error),
}Expand description
Every failure the binary can exit with.
Variants§
Usage(String)
Semantically invalid arguments clap cannot reject on shape alone.
NotFound
A named payload entry does not exist; the caller can list the
valid names with --list.
Fields
Refused(String)
The command refused to touch the target as found, and the target was left unchanged.
Refusal(Box<Diagnostic>)
A refusal with its parts named, carrying its own reason and the
hints the boundary renders. New refusals use this; Self::Refused
remains for the paths not yet carrying structured hints.
Missing(Box<Diagnostic>)
A named input is absent — a target that is not a repository, or detection that finds no remote — mapping to the sysexits no-input code rather than the refusal code.
CheckFailed(Box<Diagnostic>)
A check ran and found violations: the one sanctioned bare exit 1, after the per-item report has already been rendered.
Subprocess(Box<Diagnostic>)
A child process ran and failed for a reason this binary cannot classify further; the child’s own stderr travels with it.
Io(Error)
Filesystem failure, classified by its I/O kind.
Other(Error)
Escape hatch for ad-hoc contexts at the binary boundary.
Implementations§
Source§impl RkError
impl RkError
Sourcepub fn refusal(diagnostic: Diagnostic) -> Self
pub fn refusal(diagnostic: Diagnostic) -> Self
A Self::Refusal from a built diagnostic.
Sourcepub fn missing(diagnostic: Diagnostic) -> Self
pub fn missing(diagnostic: Diagnostic) -> Self
A Self::Missing from a built diagnostic.
Sourcepub fn check_failed(diagnostic: Diagnostic) -> Self
pub fn check_failed(diagnostic: Diagnostic) -> Self
A Self::CheckFailed from a built diagnostic.
Sourcepub fn subprocess(diagnostic: Diagnostic) -> Self
pub fn subprocess(diagnostic: Diagnostic) -> Self
A Self::Subprocess from a built diagnostic.
Sourcepub fn exit_code(&self) -> u8
pub fn exit_code(&self) -> u8
Map to the process exit code.
64..=78 follow BSD sysexits(3) and mean the tool itself could
not do its job.
Sourcepub fn reason(&self) -> Reason
pub fn reason(&self) -> Reason
The reason beside the code: a Self::Refusal carries its own,
and every other variant maps to its honest coarse entry.
Sourcepub fn diagnostic(&self) -> Diagnostic
pub fn diagnostic(&self) -> Diagnostic
The typed form of this failure, for the JSON rendering.
Trait Implementations§
Source§impl Error for RkError
impl Error for RkError
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()