#[non_exhaustive]pub enum Error {
Show 22 variants
Io(Error),
Http(Error),
Json(Error),
Zip(ZipError),
Header(ToStrError),
ParseInt(ParseIntError),
MissingHeader(String),
Config(String),
ManifestParse(String),
Cache(String),
SizeLimitExceeded {
context: String,
limit: u64,
actual: Option<u64>,
},
IncompleteDownload {
expected: u64,
actual: u64,
},
UnsafeName(String),
UnsupportedCacheVersion {
found: u32,
expected: u32,
},
Ecosystem(String),
Install(String),
Profile(String),
BadProfile(BadProfile),
Download {
failed: usize,
total: usize,
first: String,
},
InvalidHeader(String),
ExtractLimitExceeded(String),
ChecksumMismatch {
path: String,
expected: u32,
actual: u32,
},
}Expand description
Represents all possible errors that can occur within the Thunderstore engine.
This enum is #[non_exhaustive]: new variants may be added in future
releases without a breaking change, so downstream matches must include a
wildcard arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io(Error)
Error from the IO system.
Http(Error)
Error from HTTP operations.
Json(Error)
Error from JSON parsing.
Zip(ZipError)
Error from ZIP operations.
Header(ToStrError)
Error from header parsing.
ParseInt(ParseIntError)
Error from parsing integers.
MissingHeader(String)
Missing header in response.
Config(String)
Error from builder or configuration validation.
ManifestParse(String)
Error parsing a per-mod manifest.json.
Cache(String)
Error reading, writing, or validating the on-disk package-index cache.
Covers cache load/decode/encode, a missing cache, an incompatible or
corrupt cache layout, and the integrity checks in
PackageIndex::validate — which run at the
cache boundary.
SizeLimitExceeded
A network body, manifest file, or decompressed payload exceeded a configured size limit.
actual is a structured field for programmatic inspection; it is
deliberately not rendered in Display because thiserror cannot
conditionally format an Option.
Fields
IncompleteDownload
A download ended before the declared number of bytes arrived.
Fields
UnsafeName(String)
A download filename was unsafe (empty, absolute, or path-traversing).
UnsupportedCacheVersion
The on-disk cache was written by an incompatible version of the cache format. The client treats this as a cache miss and re-fetches.
Fields
Ecosystem(String)
Error from ecosystem-schema parsing.
Install(String)
Error from install routing, e.g. a package that would escape the install root.
Profile(String)
Error from the profile layer: an invalid profile name, a malformed
mods.yml/state file, or a profile operation that could not complete.
BadProfile(BadProfile)
A profile name that could not be used, from any operation that gates on
layout::require_profile.
Carries the reason rather than a sentence so an operation with other
failure modes, such as
layout::use_profile, can still
return one Error without a caller losing the ability to word the refusal
itself. Renders exactly as Error::Profile did for the same refusal.
Download
One or more files in a batch download failed.
Fields
InvalidHeader(String)
A response header was present but could not be parsed, e.g. an
unparseable Last-Modified value.
ExtractLimitExceeded(String)
An archive exceeded a configured extraction limit (entry count or uncompressed size), e.g. a zip bomb.
ChecksumMismatch
CRC32 verification failed while extracting an archive entry.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()