/ backend / src / registry_error.rs
registry_error.rs
 1  use std::io;
 2  
 3  #[derive(Debug, thiserror::Error)]
 4  pub enum RegistryError {
 5      #[error("Sqlx error")]
 6      SqlxError(#[from] sqlx::Error),
 7      #[error("Rocket error")]
 8      RocketError(#[from] rocket::Error),
 9      #[error("IO Error")]
10      IOError(#[from] io::Error),
11      #[error("Session with was not found")]
12      SessionNotFound,
13      #[error("Invalid content length")]
14      InvalidContentLength,
15      #[error("Invalid state")]
16      InvalidState,
17      #[error("Unsupported digest algorithm")]
18      UnsupportedDigest,
19      #[error("Unsupported manifest type")]
20      UnsupportedManifestType,
21      #[error("Invalid digest")]
22      InvalidDigest,
23      #[error("Invalid manifest schema")]
24      InvalidManifestSchema(String),
25      #[error("Serde json error")]
26      SerdeJsonError(#[from] serde_json::Error),
27      #[error("Invalid content range")]
28      InvalidContentRange,
29      #[error("Invalid session id")]
30      InvalidSessionId,
31      #[error("Invalid starting index")]
32      InvalidStartIndex,
33      #[error("The blob part has already been uploaded")]
34      BlobPartAlreadyUploaded,
35      #[error("Blob not found")]
36      BlobNotFound,
37      #[error("Blob file not found")]
38      BlobFileNotFound,
39      #[error("Manifest not found")]
40      ManifestNotFound,
41      #[error("Manifest file not found")]
42      ManifestFileNotFound,
43      #[error("Manifest still references blob")]
44      BlobManifestStillExists,
45      #[error("Failed to delete tag")]
46      FailedToDeleteTag,
47  }
48  
49  pub type RegistryResult<T> = Result<T, RegistryError>;