#[non_exhaustive]pub enum CleanLibraryError {
Show 14 variants
Config(ConfigError),
PolicyDeny {
reason_code: String,
message: String,
},
IntegrityFailure {
reason_code: String,
message: String,
},
RateLimitExceeded {
retry_after_seconds: u64,
message: String,
},
RiskAcceptanceRequired {
reason_code: String,
message: String,
guidance: Option<String>,
docs_url: Option<String>,
},
Authentication {
reason_code: String,
message: String,
},
InsufficientData {
reason_code: String,
message: String,
},
CoverageIncomplete {
reason_code: String,
message: String,
},
AttestationInvalid {
reason_code: String,
message: String,
},
PackageNotFound(String),
ServerError {
status: u16,
message: String,
retryable: bool,
},
Problem {
problem: ProblemDetails,
},
Transport(TransportError),
Parse(String),
}Expand description
Top-level error type for cleanlib-client operations. Mirrors Rev 1 §2.3 mapping table.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Config(ConfigError)
PolicyDeny
Policy DENY — 403 + POLICY_DENY_VERDICT / POLICY_DENY_RULE_EXPLICIT,
or 451 Unavailable For Legal Reasons (npm ecosystem alias).
IntegrityFailure
403 + INTEGRITY_FAILURE — package hash mismatch on serve path
(security incident; App refuses serve).
RateLimitExceeded
429 Too Many Requests + Retry-After header.
RiskAcceptanceRequired
403 + RISK_ACCEPTANCE_REQUIRED — policy permits ALLOW but customer
hasn’t signed risk-acceptance for this package/version. Customer should
emit a rule via cleanlib risk-accept and upload to CDP admin UI.
Authentication
401 or 403 + KEY_INVALID / KEY_EXPIRED / KEY_SCOPE_INSUFFICIENT.
InsufficientData
403 + INSUFFICIENT_DATA_FAIL_CLOSED — verdict unavailable + customer
policy fails closed on missing data.
CoverageIncomplete
CLEANLIB-657 (CX-8): a scan/fix run could not evaluate one or more coordinates (outage / TLS / 5xx / unreachable). NOT a verdict — the gate did not fully run; callers must never read this as clean coverage.
AttestationInvalid
CLEANLIB-657 (CX-8): a signed attestation was present but failed verification (signature / key / canonical-form mismatch).
PackageNotFound(String)
404 Not Found — package not in catalog + ingest declined or unavailable.
ServerError
5xx — server error. retryable=true for 502/503/504.
Problem
CLEANLIB-536: an RFC 9457 application/problem+json structured error.
Carries the App’s problem document — the standard
type/title/status/detail/instance members plus the CLEANLIB-536
extensions reason_class (the machine-stable branch key —
not_ingested / dependency_degraded / permanently_blocked /
service_unavailable), retryable, selfHealing, and resolution.
Consumers branch on problem.reason_class and honor problem.retryable
rather than scraping status codes or the raw body. Emitted when the App
response is application/problem+json; legacy header/status responses
keep the variants above.
Fields
problem: ProblemDetailsTransport(TransportError)
Network / TLS / timeout / DNS — pre-response transport-layer failure.
Parse(String)
Response body parse failure (malformed JSON, schema mismatch).
Implementations§
Source§impl CleanLibraryError
impl CleanLibraryError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
True if a transient retry could plausibly succeed. Callers may use this to gate retry/backoff logic. Per Rev 1 §2.3 + App Rev 4 §9.2.
Sourcepub fn reason_code(&self) -> Option<&str>
pub fn reason_code(&self) -> Option<&str>
Reason code from App’s X-CleanLibrary-Reason header, if any.
Trait Implementations§
Source§impl Debug for CleanLibraryError
impl Debug for CleanLibraryError
Source§impl Display for CleanLibraryError
impl Display for CleanLibraryError
Source§impl Error for CleanLibraryError
impl Error for CleanLibraryError
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()