-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from lann/refactor-common-loader
ref(*)!: Refactors loader to use the new common package (subset of #34)
- Loading branch information
Showing
29 changed files
with
785 additions
and
1,149 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,52 @@ | ||
use http::uri::InvalidUri; | ||
use label::Label; | ||
|
||
pub mod config; | ||
mod label; | ||
mod package; | ||
pub mod label; | ||
pub mod metadata; | ||
pub mod package; | ||
pub mod registry; | ||
|
||
use label::InvalidLabel; | ||
pub use registry::Registry; | ||
|
||
#[derive(Debug, thiserror::Error)] | ||
pub enum Error { | ||
#[error("error reading config file: {0}")] | ||
ConfigFileIoError(#[source] std::io::Error), | ||
#[error("failed to get registry credentials: {0:#}")] | ||
CredentialError(#[source] anyhow::Error), | ||
#[error("invalid config: {0}")] | ||
InvalidConfig(#[source] Box<dyn std::error::Error>), | ||
InvalidConfig(#[source] anyhow::Error), | ||
#[error("invalid content: {0}")] | ||
InvalidContent(String), | ||
#[error("invalid content digest: {0}")] | ||
InvalidContentDigest(String), | ||
#[error("invalid package manifest: {0}")] | ||
InvalidPackageManifest(String), | ||
#[error("invalid package pattern: {0}")] | ||
InvalidPackagePattern(String), | ||
#[error("invalid label: {0}")] | ||
InvalidLabel(#[from] InvalidLabel), | ||
InvalidLabel(#[from] label::InvalidLabel), | ||
#[error("invalid package ref: {0}")] | ||
InvalidPackageRef(String), | ||
#[error("invalid registry: {0}")] | ||
InvalidRegistry(#[from] InvalidUri), | ||
#[error("invalid registry metadata: {0}")] | ||
InvalidRegistryMetadata(#[source] serde_json::Error), | ||
InvalidRegistryMetadata(#[source] anyhow::Error), | ||
#[error("invalid version: {0}")] | ||
InvalidVersion(#[from] semver::Error), | ||
#[error("IO error: {0}")] | ||
IoError(#[from] std::io::Error), | ||
#[error("no registry configured for namespace {0:?}")] | ||
NoRegistryForNamespace(Label), | ||
#[error("registry error: {0}")] | ||
RegistryError(#[source] anyhow::Error), | ||
#[error("registry metadata error: {0:#}")] | ||
RegistryMetadataError(#[source] anyhow::Error), | ||
#[error("version not found: {0}")] | ||
VersionNotFound(semver::Version), | ||
} | ||
|
||
impl Error { | ||
fn invalid_config(err: impl std::error::Error + 'static) -> Self { | ||
Self::InvalidConfig(Box::new(err)) | ||
fn invalid_config(err: impl Into<anyhow::Error>) -> Self { | ||
Self::InvalidConfig(err.into()) | ||
} | ||
} |
Oops, something went wrong.