use super::suggestion::Suggestion;
use super::vocab::{
AllowlistStage, ContentKind, DestructiveEffect, InternalOp, IoCause, IoOp, Subject, ValueSource,
};
use crate::error::ErrorKind;
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum ErrorDetail {
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>,
},
}