Skip to main content

dfx_core/error/
wallet_config.rs

1use crate::error::config::ConfigError;
2use crate::error::fs::{CreateDirAllError, EnsureParentDirExistsError};
3use crate::error::structured_file::StructuredFileError;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
7pub enum WalletConfigError {
8    #[error("failed to ensure existence of parent directory for wallet configuration")]
9    EnsureWalletConfigDirFailed(#[source] CreateDirAllError),
10
11    #[error("Failed to get wallet configuration path")]
12    GetWalletConfigPathFailed(Box<String>, Box<String>, #[source] ConfigError),
13
14    #[error("Failed to load wallet configuration")]
15    LoadWalletConfigFailed(#[source] StructuredFileError),
16
17    #[error("Failed to save wallet configuration")]
18    SaveWalletConfig(#[from] SaveWalletConfigError),
19
20    #[error("cannot use a wallet before dfx start")]
21    NoWalletBeforeDfxStart,
22}
23
24#[derive(Error, Debug)]
25pub enum SaveWalletConfigError {
26    #[error(transparent)]
27    EnsureParentDirExists(#[from] EnsureParentDirExistsError),
28
29    #[error(transparent)]
30    SaveJsonFile(#[from] StructuredFileError),
31}