kellnr_storage/
storage_error.rs1use std::path::PathBuf;
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum StorageError {
7 #[error("Failed to create crate_folder")]
8 CreateCrateFolder(std::io::Error),
9 #[error("Crate with version already exists: {0}-{1}")]
10 CrateExists(String, String),
11 #[error("Failed to read crate file {0:?} to calc cksum after {1} tries")]
12 ReadCrateFileTries(PathBuf, usize),
13 #[error("Failed to create file {0} on storage: {1:?}")]
14 CreateFile(std::io::Error, PathBuf),
15 #[error("Failed to write crate to file {0:?}: {1}")]
16 WriteCrateFile(PathBuf, std::io::Error),
17 #[error("Failed to open crate file {0:?} to calc cksum: {1}")]
18 OpenCrateFileToCalckCksum(PathBuf, std::io::Error),
19 #[error("Failed to read crate file {0:?} to calc cksum: {1}")]
20 ReadCrateFileToCalcCksum(PathBuf, std::io::Error),
21 #[error("Failed to create bin path for crate file {0:?}: {1}")]
22 CreateBinPath(PathBuf, std::io::Error),
23 #[error("Failed to create doc queue sub-path {0:?}: {1}")]
24 CreateDocQueuePath(PathBuf, std::io::Error),
25 #[error("Failed to remove file {0:?} from crate storage: {1}")]
26 RemoveFile(String, std::io::Error),
27 #[error("Failed to read crate metadata from file {0:?}: {1}")]
28 ReadCrateMetadata(PathBuf, std::io::Error),
29 #[error("File does not exist: {0:?}")]
30 FileDoesNotExist(PathBuf),
31 #[error("Failed to open file {0:?} on storage: {1}")]
32 OpenFileOnStorage(PathBuf, std::io::Error),
33 #[error("Failed to read file {0:?}: {1}")]
34 ReadFile(PathBuf, std::io::Error),
35 #[error("Failed to read from file handle: {0}")]
36 ReadFileHandle(std::io::Error),
37 #[error("Failed to flush file {0:?}: {1}")]
38 FlushCrateFile(PathBuf, std::io::Error),
39 #[error("Failed to init storage provider. Reason: {0}")]
40 StorageInitError(String),
41 #[error("Error from storage provider. Reason: {0}")]
42 GenericError(String),
43 #[error("S3 error: {0}")]
44 S3Error(#[from] object_store::Error),
45 #[error("S3 path error: {0}")]
46 S3PathError(#[from] object_store::path::Error),
47 #[error("Toolchain archive already exists: {name}-{version}-{target}")]
48 ToolchainArchiveExists {
49 name: String,
50 version: String,
51 target: String,
52 },
53 #[error("Failed to store toolchain archive {name}-{version}-{target}: {reason}")]
54 ToolchainStoreFailed {
55 name: String,
56 version: String,
57 target: String,
58 reason: String,
59 },
60 #[error("Toolchain archive not found: {path}")]
61 ToolchainNotFound { path: String },
62 #[error("Failed to retrieve toolchain archive {path}: {reason}")]
63 ToolchainGetFailed { path: String, reason: String },
64 #[error("Failed to delete toolchain archive {path}: {reason}")]
65 ToolchainDeleteFailed { path: String, reason: String },
66}