Available on crate feature
terminal only.Expand description
Command failure reporting to stdout.
ErrorReport renders a failure, with its source chain and
backtrace, as text or JSON. A binary acting as a machine contract
also gives the failures a caller is expected to act on a stable
code: it declares its own ErrorCode vocabulary, raises a
CodedError anywhere in the chain, and evaluates its result with
ErrorReport::eval_coded, which prints the code as code beside
the message. The message stays for humans and may be reworded at any
time; the code is the contract.
A command that ran to its end but did not fully succeed prints its
result, then returns a PartialOutcome: the process exits with its
status, 2 or above, and prints nothing more.
Structs§
- Coded
Error - A failure carrying an
ErrorCode, anywhere in an error chain. - Error
Report - Wraps an
anyhow::Errorto render it, with its source chain, backtrace and code, as text or JSON. - Partial
Outcome - The outcome of a command that printed its result but did not fully succeed, such as a check with a failed backend or a refusal from a server.
Enums§
- NoError
Code - The empty vocabulary of a binary whose failures carry no code.
Constants§
- EXIT_
FAILURE - The exit status of a failed command, which printed the failure object.
- EXIT_
PARTIAL - The exit status of a command that ran to its end and printed its result, whose outcome is not a full success. A command may document higher statuses for other such outcomes.
Traits§
- Error
Code - A binary’s vocabulary of stable failure codes.
Functions§
- code_of
- The code of the outermost
CodedErrorin the chain, if any. - partial_
outcome_ of - The
PartialOutcomein the chain, if any.