#[non_exhaustive]pub enum ErrorDetail {
Show 65 variants
Empty {
subject: Subject,
},
TooLong {
subject: Subject,
limit: usize,
},
Invalid {
subject: Subject,
value: String,
},
ControlCharacters {
subject: Subject,
},
NotVisibleAscii {
subject: Subject,
},
ContainsWhitespace {
subject: Subject,
value: String,
},
MustBeAtLeastOneSecond {
subject: Subject,
source: ValueSource,
},
AboveHardMaximum {
subject: Subject,
hard_max: u64,
source: ValueSource,
},
ItemPathNoSegments,
ItemPathMissingItemName,
CrateRefMultipleAt,
CrateRefEmptyName,
CrateRefEmptyVersion,
VersionBuildMetadata,
VersionVPrefix,
UnknownMatchMode {
value: String,
},
UnknownItemType {
value: String,
},
UnsupportedLang {
tag: String,
},
UnknownSchemaCommand {
value: String,
},
JsonFormatConflict,
ClapUsage {
message: String,
},
InvalidFilterExpression {
expr: String,
reason: String,
},
ModuleFilterUnsupported,
AmbientTargetRefused {
verb: String,
target: String,
target_flag: String,
waiver_flag: String,
effect: DestructiveEffect,
},
PageBelowOne,
PerPageOutOfRange {
max: u32,
got: u32,
},
OriginBadScheme {
scheme: String,
},
OriginMissingHost {
url: String,
},
OriginNotAllowlisted {
host: String,
allowed: String,
},
ItemPathSegmentCharset {
segment: String,
},
ConflictingVersions {
from_ref: String,
from_flag: String,
},
ConfigDirUnresolved,
CacheDirUnresolved,
ConfigTomlInvalid,
ConfigTomlNotUtf8,
ConfigAlreadyExists {
path: String,
},
ConfigTomlTooLarge {
max_bytes: u64,
},
UserAgentHeaderInvalid,
HttpStatus {
status: u16,
hint: String,
},
HostNotAllowlisted {
host: String,
stage: AllowlistStage,
},
HttpRequestFailed {
url: String,
kind: ErrorKind,
},
RedirectLimitExceeded,
HttpClientBuild,
BodyRead,
BodyOverBudget {
max_bytes: u64,
},
CachedBodyOverBudget {
max_bytes: u64,
},
BodyReserveFailed {
bytes: usize,
},
BodyNotUtf8,
UnexpectedContentType {
expected: ContentKind,
got: String,
},
OutputOverBudget,
HtmlToMarkdown,
CratesIoJson,
AssocParentPageNotFound,
AssocAnchorMissing {
anchors: String,
},
AssocAnchorEmpty {
anchor_id: String,
},
MemberKindNeedsParent {
kind: &'static str,
member: String,
parent_kinds: String,
},
HitJoinFailed,
HitBaseInvalid,
Interrupted,
Terminated,
BrokenPipe,
WallClockTimeout {
secs: u64,
},
Io {
op: IoOp,
path: Option<String>,
cause: IoCause,
},
Internal {
op: InternalOp,
},
WithSuggestions {
base: Box<ErrorDetail>,
suggestions: Vec<Suggestion>,
},
}Expand description
Every failure the product can report, as data.
Construct errors through super::AppError::of so the ErrorKind and the
English wire message are both derived from one place.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Empty
subject was empty or blank.
TooLong
subject was longer than limit characters.
Invalid
subject did not satisfy its format rule.
Fields
ControlCharacters
subject contained control or invisible characters.
NotVisibleAscii
subject must be printable ASCII only.
ContainsWhitespace
subject contained whitespace where none is allowed.
MustBeAtLeastOneSecond
A duration knob was set to zero.
Fields
source: ValueSourceLayer the value came from (decides invalid_input vs config).
AboveHardMaximum
A byte budget was raised above the product’s hard ceiling.
Fields
source: ValueSourceLayer the value came from (decides invalid_input vs config).
ItemPathNoSegments
An item path yielded no usable segments.
ItemPathMissingItemName
A non-module item path ended without an item name.
CrateRefMultipleAt
A crate reference carried more than one @.
CrateRefEmptyName
A crate reference had nothing before its @.
CrateRefEmptyVersion
A crate reference had nothing after its @.
VersionBuildMetadata
A version carried +build metadata, which docs.rs does not resolve.
VersionVPrefix
A version was written with the v prefix.
UnknownMatchMode
--match received a value outside the accepted set.
UnknownItemType
A kind alias was not recognized.
UnsupportedLang
--lang received an unsupported BCP-47 tag.
UnknownSchemaCommand
schema --cmd named a document that does not exist.
JsonFormatConflict
--json was combined with a human output format.
ClapUsage
Argv failed clap parsing.
The text is clap’s own rendering, not ours, so it is carried verbatim
and not translated — inventing a pt-BR version of someone else’s usage
help would drift from what --help actually prints.
InvalidFilterExpression
--filter could not be parsed.
ModuleFilterUnsupported
search-in-crate --item-type module has no catalogue to read.
AmbientTargetRefused
A destructive verb resolved its target from ambient state, not from argv.
This is the confused-deputy shape: the caller names the verb, the environment names the victim, and the two are never compared. Refusing here costs one flag; not refusing costs whichever cache root the process happened to resolve.
Fields
effect: DestructiveEffectWhat would have happened to the target.
Carried as data because the harm differs by verb: the first version of this message said “would delete” for every caller, which was simply false once a verb that overwrites started using it.
PageBelowOne
--page was zero or absent where one is required.
PerPageOutOfRange
--per-page fell outside its accepted range.
OriginBadScheme
An origin URL used a scheme other than http or https.
OriginMissingHost
An origin URL carried no host component.
OriginNotAllowlisted
An origin host was outside the SSRF allowlist.
Fields
ItemPathSegmentCharset
An item path segment used characters outside the accepted set.
ConflictingVersions
crate@version and --crate-version disagreed.
Fields
ConfigDirUnresolved
The XDG config directory could not be resolved.
CacheDirUnresolved
The XDG cache directory could not be resolved.
ConfigTomlInvalid
config.toml failed to parse as TOML.
ConfigTomlNotUtf8
config.toml was not valid UTF-8.
ConfigAlreadyExists
config init found an existing file and --force was absent.
ConfigTomlTooLarge
config.toml was larger than the read cap.
UserAgentHeaderInvalid
The configured User-Agent was rejected as an HTTP header value.
HttpStatus
A remote returned a status that maps to a domain failure.
Fields
HostNotAllowlisted
A request or redirect targeted a host outside the allowlist.
Fields
stage: AllowlistStageWhich stage rejected it, so the operator knows where to look.
HttpRequestFailed
The transport failed before any status was seen.
Carries its own ErrorKind because the classification comes from
reqwest (timeout vs connect vs body), not from the shape of the call.
Fields
RedirectLimitExceeded
The redirect chain went past max_redirects.
HttpClientBuild
Building the HTTP client failed.
BodyRead
Reading the response body failed mid-stream.
BodyOverBudget
The response body passed the configured byte budget.
CachedBodyOverBudget
A cached body no longer fits the current byte budget.
BodyReserveFailed
Reserving body capacity failed (allocation refused).
BodyNotUtf8
The response body was not valid UTF-8.
UnexpectedContentType
The response advertised a content type the endpoint cannot use.
OutputOverBudget
The emitted payload passed max_output_bytes.
HtmlToMarkdown
HTML could not be converted to Markdown.
CratesIoJson
crates.io returned JSON the parser rejected.
AssocParentPageNotFound
No parent page existed for an associated item.
AssocAnchorMissing
The parent page was found but carried no anchor for the member.
The rendered text must keep the sentinel prefix, since both the live probe and the recovery path match on it to stop walking parent kinds.
AssocAnchorEmpty
The member anchor existed but its docblock was empty.
MemberKindNeedsParent
A member-only kind was requested without a parent to anchor against.
Fields
HitJoinFailed
A hit href could not be joined against its origin.
HitBaseInvalid
A hit’s source_url was not a usable join base.
Interrupted
SIGINT / Ctrl-C.
Terminated
SIGTERM.
BrokenPipe
stdout was closed by the reader.
WallClockTimeout
The wall-clock deadline elapsed.
Io
A filesystem operation failed; the cause is on the source chain.
Build this with Self::io rather than by hand: the constructor is what
classifies the OS cause while the std::io::Error is still available,
and a hand-written cause is a guess about a value the caller already had.
Fields
Internal
An internal invariant or host facility failed.
Fields
op: InternalOpWhat was being attempted.
WithSuggestions
Another failure, with ranked --suggest alternatives appended.
Fields
base: Box<ErrorDetail>The failure being explained.
suggestions: Vec<Suggestion>Ranked alternatives, best first.
Implementations§
Source§impl ErrorDetail
impl ErrorDetail
Sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Canonical ErrorKind for this failure.
Derived here rather than passed by the caller so one detail can never be reported as two different kinds from two different call sites.
Sourcepub fn io(op: IoOp, path: Option<String>, err: &Error) -> Self
pub fn io(op: IoOp, path: Option<String>, err: &Error) -> Self
Build a filesystem failure, classifying the OS cause at the call site.
The classification has to happen here because this is the last place the
std::io::Error exists. One layer up there is only an ErrorKind,
and ENOSPC and EACCES share it while deserving opposite answers.
Sourcepub fn retryable(&self) -> bool
pub fn retryable(&self) -> bool
Whether an agent may retry the invocation that produced this failure.
Every kind but crate::error::ErrorKind::Io answers from the kind alone. Filesystem
failure is the one case where two opposite answers share a kind, so the
cause captured at construction wins.
Trait Implementations§
Source§impl Clone for ErrorDetail
impl Clone for ErrorDetail
Source§impl Debug for ErrorDetail
impl Debug for ErrorDetail
impl Eq for ErrorDetail
Source§impl PartialEq for ErrorDetail
impl PartialEq for ErrorDetail
impl StructuralPartialEq for ErrorDetail
Auto Trait Implementations§
impl Freeze for ErrorDetail
impl RefUnwindSafe for ErrorDetail
impl Send for ErrorDetail
impl Sync for ErrorDetail
impl Unpin for ErrorDetail
impl UnsafeUnpin for ErrorDetail
impl UnwindSafe for ErrorDetail
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.