Skip to main content

bittensor_wallet/
errors.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum KeyFileError {
5    #[error("Failed to create directory: {0}")]
6    DirectoryCreation(String),
7    #[error("Failed to get metadata: {0}")]
8    MetadataError(String),
9    #[error("File does not exist: {0}")]
10    FileNotFound(String),
11    #[error("File is not readable: {0}")]
12    NotReadable(String),
13    #[error("File is not writable: {0}")]
14    NotWritable(String),
15    #[error("Failed to open file: {0}")]
16    FileOpen(String),
17    #[error("Failed to read file: {0}")]
18    FileRead(String),
19    #[error("Failed to write file: {0}")]
20    FileWrite(String),
21    #[error("Failed to set permissions: {0}")]
22    PermissionError(String),
23    #[error("Serialization error: {0}")]
24    SerializationError(String),
25    #[error("Deserialization error: {0}")]
26    DeserializationError(String),
27    #[error("Encryption error: {0}")]
28    EncryptionError(String),
29    #[error("Decryption error: {0}")]
30    DecryptionError(String),
31    #[error("Invalid encryption method: {0}")]
32    InvalidEncryption(String),
33    #[error("Environment variable error: {0}")]
34    EnvVarError(String),
35    #[error("Password error: {0}")]
36    PasswordError(String),
37    #[error("Base64 decoding error: {0}")]
38    Base64DecodeError(String),
39    #[error("Base64 encoding error: {0}")]
40    Base64EncodeError(String),
41    #[error("Generic error: {0}")]
42    Generic(String),
43}
44
45#[derive(Error, Debug)]
46pub enum ConfigurationError {
47    #[error("ConfigurationError: {0}")]
48    Message(String),
49}
50
51#[derive(Error, Debug)]
52pub enum PasswordError {
53    #[error("PasswordError: {0}")]
54    Message(String),
55}
56#[derive(Error, Debug)]
57pub enum WalletError {
58    #[error("WalletError: {0}")]
59    KeyGeneration(String),
60    #[error("WalletError: {0}")]
61    InvalidInput(String),
62    #[error("WalletError: {0}")]
63    KeyFileError(#[from] KeyFileError),
64}