pub enum Error {
Show 14 variants
Io(Error),
Thunderstore(Error),
Zip(ZipError),
Json(Error),
RegistryNotFound(String),
Other(Box<dyn StdError + Send + Sync>),
MissingMetadata,
InvalidMetadata(Error),
FileNotFound(Utf8PathBuf),
InvalidFileType(Utf8PathBuf),
PackageNotFound,
VersionNotFound,
LocalManifestMissing,
LocalVersionMissing,
}Expand description
Errors returned by registry operations.
Wraps I/O errors, Thunderstore client errors, zip errors, JSON errors, and several registry-specific error conditions such as missing packages, missing or invalid metadata, and file-not-found.
§Examples
use loadsmith_registry::Error;
let err = Error::PackageNotFound;
assert_eq!(err.to_string(), "package not found");
let io_err = Error::Io(std::io::Error::new(std::io::ErrorKind::NotFound, "missing"));
assert!(io_err.to_string().contains("I/O error"));Variants§
Io(Error)
An I/O error occurred while reading a file or directory.
Thunderstore(Error)
An error from the Thunderstore API client.
Zip(ZipError)
An error while reading a zip archive.
Json(Error)
An error while serialising or deserialising JSON metadata.
RegistryNotFound(String)
A registry with the given identifier was not found in the set.
Other(Box<dyn StdError + Send + Sync>)
An opaque, boxed error from an external source.
MissingMetadata
A registry operation required metadata but none was provided.
InvalidMetadata(Error)
The metadata provided to the registry was not valid for the expected schema.
FileNotFound(Utf8PathBuf)
A required file does not exist at the given path.
InvalidFileType(Utf8PathBuf)
The file at the given path is not a recognised type.
PackageNotFound
The requested package could not be found in the registry.
VersionNotFound
The requested package version could not be found.
LocalManifestMissing
A local package source is missing its manifest.json.
LocalVersionMissing
A local package’s version could not be determined and no source_version was supplied.
Implementations§
Source§impl Error
impl Error
Sourcepub fn other<E: StdError + Send + Sync + 'static>(err: E) -> Self
pub fn other<E: StdError + Send + Sync + 'static>(err: E) -> Self
Wrap an arbitrary error into the Error::Other variant.
§Examples
use loadsmith_registry::Error;
let custom = "something went wrong".to_string();
let err = Error::other(std::io::Error::new(std::io::ErrorKind::Other, custom));
assert!(err.to_string().contains("something went wrong"));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()