forked from opentensor/btwallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.rs
64 lines (61 loc) · 1.82 KB
/
errors.rs
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use thiserror::Error;
#[derive(Error, Debug)]
pub enum KeyFileError {
#[error("Failed to create directory: {0}")]
DirectoryCreation(String),
#[error("Failed to get metadata: {0}")]
MetadataError(String),
#[error("File does not exist: {0}")]
FileNotFound(String),
#[error("File is not readable: {0}")]
NotReadable(String),
#[error("File is not writable: {0}")]
NotWritable(String),
#[error("Failed to open file: {0}")]
FileOpen(String),
#[error("Failed to read file: {0}")]
FileRead(String),
#[error("Failed to write file: {0}")]
FileWrite(String),
#[error("Failed to set permissions: {0}")]
PermissionError(String),
#[error("Serialization error: {0}")]
SerializationError(String),
#[error("Deserialization error: {0}")]
DeserializationError(String),
#[error("Encryption error: {0}")]
EncryptionError(String),
#[error("Decryption error: {0}")]
DecryptionError(String),
#[error("Invalid encryption method: {0}")]
InvalidEncryption(String),
#[error("Environment variable error: {0}")]
EnvVarError(String),
#[error("Password error: {0}")]
PasswordError(String),
#[error("Base64 decoding error: {0}")]
Base64DecodeError(String),
#[error("Base64 encoding error: {0}")]
Base64EncodeError(String),
#[error("Generic error: {0}")]
Generic(String),
}
#[derive(Error, Debug)]
pub enum ConfigurationError {
#[error("ConfigurationError: {0}")]
Message(String),
}
#[derive(Error, Debug)]
pub enum PasswordError {
#[error("PasswordError: {0}")]
Message(String),
}
#[derive(Error, Debug)]
pub enum WalletError {
#[error("WalletError: {0}")]
KeyGeneration(String),
#[error("WalletError: {0}")]
InvalidInput(String),
#[error("WalletError: {0}")]
KeyFileError(#[from] KeyFileError),
}