1use oci_client::errors::OciDistributionError;
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum RegistryError {
9 #[error("OCI distribution error: {0}")]
11 Oci(#[from] OciDistributionError),
12
13 #[error("cache error: {0}")]
15 Cache(#[from] CacheError),
16
17 #[error("image {image} not found in registry {registry}")]
19 NotFound { registry: String, image: String },
20
21 #[error("authentication failed for registry {registry}: {reason}")]
23 AuthFailed { registry: String, reason: String },
24
25 #[error("pull cancelled for image {image}")]
27 PullCancelled { image: String },
28}
29
30#[derive(Debug, Error)]
32pub enum CacheError {
33 #[error("IO error: {0}")]
35 Io(#[from] std::io::Error),
36
37 #[error("database error: {0}")]
39 Database(String),
40
41 #[error("blob {digest} not found in cache")]
43 NotFound { digest: String },
44
45 #[error("cache corrupted: {0}")]
47 Corrupted(String),
48
49 #[error("invalid digest format: {0}")]
51 InvalidDigest(String),
52}
53
54pub type Result<T, E = RegistryError> = std::result::Result<T, E>;