1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use bincode::ErrorKind;
use err_derive::Error;
use std::io::Error as IoError;
pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, Error)]
#[allow(missing_docs)]
pub enum Error {
#[error(display = "An error during compression or decompression.")]
Compression,
#[error(display = "An error during initializing CBC-AES cipher instance.")]
Cipher(String),
#[error(display = "An error within the symmetric encryption process.")]
Encryption,
#[error(display = "An error within the symmetric decryption process({})", _0)]
Decryption(String),
#[error(display = "A generic I/O error")]
Io(#[source] IoError),
#[error(display = "Generic error({})", _0)]
Generic(String),
#[error(display = "Serialisation error")]
Bincode(#[source] Box<ErrorKind>),
#[error(display = "deserialization")]
Deserialise,
#[error(display = "num parse error")]
NumParse(#[source] std::num::ParseIntError),
#[error(display = "Rng error")]
Rng(#[source] rand::Error),
#[error(display = "Unable to obtain lock")]
Poison,
}