engine/snapshot/migration/
error.rs1use crypto::keys::age;
5use thiserror::Error as DeriveError;
6
7#[derive(Debug, DeriveError)]
8pub enum Error {
9 #[error("can't migrate between selected versions")]
11 BadMigrationVersion,
12 #[error("input snapshot has incorrect/unexpected version")]
14 BadSnapshotVersion,
15 #[error("input file has incorrect format")]
17 BadSnapshotFormat,
18 #[error("failed to decrypt snapshot: incorrect password or corrupt data")]
20 DecryptFailed,
21 #[error("failed to decompress snapshot")]
23 DecompressFailed,
24 #[error("authenticated associated data is not supported by snapshot format")]
26 AadNotSupported,
27 #[error("failed to generate randomness")]
29 RngFailed,
30 #[error("age format error")]
32 AgeFormatError(age::DecError),
33 #[error("I/O error")]
35 IoError(std::io::Error),
36 #[error("crypto error")]
38 CryptoError(crypto::Error),
39}
40
41impl From<age::DecError> for Error {
42 fn from(e: age::DecError) -> Self {
43 Self::AgeFormatError(e)
44 }
45}
46
47impl From<std::io::Error> for Error {
48 fn from(e: std::io::Error) -> Self {
49 Self::IoError(e)
50 }
51}
52
53impl From<crypto::Error> for Error {
54 fn from(e: crypto::Error) -> Self {
55 Self::CryptoError(e)
56 }
57}