1use crate::storage::StorageError;
6use thiserror::Error;
7
8#[derive(Debug, Error)]
10#[non_exhaustive]
11pub enum Error {
12 #[error("read disk error")]
14 ReadDisk(#[source] StorageError),
15 #[error("write disk error")]
17 WriteDisk(#[source] StorageError),
18 #[error("flush disk error")]
20 FlushDisk(#[source] StorageError),
21
22 #[error("invalid file id or file header")]
24 FileInfo,
25 #[error("no allocated bytes for file id being read")]
27 FileInfoAllocated,
28 #[error("cannot allocate 0 blocks")]
30 AllocateZero,
31 #[error("invalid data allocation offsets")]
33 AllocateOffset,
34 #[error("insufficient resources")]
36 InsufficientResources,
37 #[error("invalid file id")]
39 FileId,
40 #[error("invalid data buffer length")]
42 WriteFileLength,
43 #[error("trying to allocate too many blocks")]
45 WriteFileBlocks,
46 #[error("Fatal initialization error: {0}")]
48 Initialization(String),
49 #[error("VMGS_INVALID_FORMAT: {0}")]
51 InvalidFormat(String),
52 #[error("VMGS_CORRUPT_FORMAT: {0}")]
54 CorruptFormat(String),
55 #[error("empty file")]
57 EmptyFile,
58 #[error("cannot overwrite encrypted file with plaintext data")]
60 OverwriteEncrypted,
61 #[error("cannot read encrypted file - VMGS is locked")]
63 ReadEncrypted,
64
65 #[cfg(feature = "encryption_ossl")]
67 #[error("OpenSSL error {1}: {0}")]
68 OpenSSL(#[source] openssl::error::ErrorStack, String),
69
70 #[error(transparent)]
72 Other(#[from] anyhow::Error),
73}