Skip to main content

Module error

Module error 

Source
Expand description

Error types and exit-code mapping for docsrs-cli.

§Model (Rules Rust — error handling)

  • Recoverable failures are AppError / AppResult (I/O, network, parse, validation).
  • ErrorKind is the stable discriminant for exit codes and JSON error.kind.
  • std::error::Error::source preserves the lower-level cause when present.
  • Display messages are technical English: lowercase, no trailing period, no secrets.
  • Panic is reserved for static invariants (hardcoded regex / CSS selectors).
  • Library API: typed thiserror enum, not anyhow / Box<dyn Error> as the public E.

See docs/decisions/0002-error-model.md.

§Errors

KindExitRetryable
usage64no
invalid_input65no
not_found66no
rate_limited / unavailable69yes
network74yes
budget74no
timeout124yes
parse65no
config78no
internal70no
interrupted (SIGINT)130no
terminated (SIGTERM)143no
broken_pipe (stdout EPIPE)141no

Structs§

Suggestion
One ranked --suggest alternative.

Enums§

AllowlistStage
Where an allowlist rejection happened.
AppError
Application error with structured kind for agents.
ContentKind
Which payload flavour a response was expected to carry.
DestructiveEffect
What a destructive verb would have done to the target it was refused.
ErrorDetail
Every failure the product can report, as data.
ErrorKind
Canonical error kinds exposed in JSON envelopes.
InternalOp
An internal invariant or infrastructure failure, for crate::error::ErrorDetail::Internal.
IoCause
Why an I/O failure is or is not worth another attempt.
IoOp
A filesystem or process operation that failed, for crate::error::ErrorDetail::Io.
Subject
The thing an error is about, when the failure shape is generic.
ValueSource
Which layer supplied a value that failed validation.

Constants§

EXIT_BROKEN_PIPE
stdout EPIPE / broken pipe.
EXIT_CONFIG
Local configuration error (XDG TOML, origins).
EXIT_INTERNAL
Unexpected internal failure.
EXIT_INTERRUPTED
SIGINT / Ctrl-C cooperative cancel.
EXIT_INVALID_INPUT
Domain validation failure (invalid crate name, path, pagination).
EXIT_IO
Local filesystem failure (sysexits EX_IOERR, the original meaning of 74).
EXIT_NETWORK
Transport / network failure or local body budget.
EXIT_NOT_FOUND
Remote resource missing (HTTP 404).
EXIT_TERMINATED
SIGTERM / SIGHUP terminate.
EXIT_TIMEOUT
Wall-clock deadline exceeded.
EXIT_UNAVAILABLE
Rate limit or temporary remote unavailability (HTTP 429/5xx).
EXIT_USAGE
Clap / argv usage error (sysexits EX_USAGE).

Functions§

io_at
Map a filesystem failure onto the catalogue, keeping the path that failed.

Type Aliases§

AppResult
Result alias for library operations.