Chore/more error macros (#2686)
* cleaned up MixProcessingError
* Added Error impl to (hopefully) all error enums in the codebase
* Replaced all occurences of error("{0}") with error(transparent)
* Changelog entry
This commit is contained in:
committed by
GitHub
parent
a020f2ad1c
commit
97b01db23e
@@ -18,7 +18,7 @@ pub(crate) fn execute(args: &Describe) {
|
||||
match Config::load_from_file(Some(&args.id)) {
|
||||
Ok(cfg) => cfg,
|
||||
Err(err) => {
|
||||
error!("Failed to load config for {}. Are you sure you have run `init` before? (Error was: {})", &args.id, err);
|
||||
error!("Failed to load config for {}. Are you sure you have run `init` before? (Error was: {err})", &args.id);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -125,7 +125,7 @@ pub(crate) fn validate_bech32_address_or_exit(address: &str) {
|
||||
if let Err(bech32_address_validation::Bech32Error::DecodeFailed(err)) =
|
||||
bech32_address_validation::try_bech32_decode(address)
|
||||
{
|
||||
let error_message = format!("Error: wallet address decoding failed: {}", err).red();
|
||||
let error_message = format!("Error: wallet address decoding failed: {err}").red();
|
||||
println!("{}", error_message);
|
||||
println!("Exiting...");
|
||||
process::exit(1);
|
||||
@@ -134,7 +134,7 @@ pub(crate) fn validate_bech32_address_or_exit(address: &str) {
|
||||
if let Err(bech32_address_validation::Bech32Error::WrongPrefix(err)) =
|
||||
bech32_address_validation::validate_bech32_prefix(&prefix, address)
|
||||
{
|
||||
let error_message = format!("Error: wallet address type is wrong, {}", err).red();
|
||||
let error_message = format!("Error: wallet address type is wrong, {err}").red();
|
||||
println!("{}", error_message);
|
||||
println!("Exiting...");
|
||||
process::exit(1);
|
||||
|
||||
@@ -57,7 +57,7 @@ fn unsupported_upgrade(config_version: &Version, package_version: &Version) -> !
|
||||
|
||||
fn parse_config_version(config: &Config) -> Version {
|
||||
let version = Version::parse(config.get_version()).unwrap_or_else(|err| {
|
||||
eprintln!("failed to parse client version! - {:?}", err);
|
||||
eprintln!("failed to parse client version! - {err}");
|
||||
process::exit(1)
|
||||
});
|
||||
|
||||
@@ -106,7 +106,7 @@ fn minor_0_12_upgrade(
|
||||
let upgraded_config = config.with_custom_version(to_version.to_string().as_ref());
|
||||
|
||||
upgraded_config.save_to_file(None).unwrap_or_else(|err| {
|
||||
eprintln!("failed to overwrite config file! - {:?}", err);
|
||||
eprintln!("failed to overwrite config file! - {err}");
|
||||
print_failed_upgrade(config_version, &to_version);
|
||||
process::exit(1);
|
||||
});
|
||||
@@ -140,7 +140,7 @@ pub(crate) fn execute(args: &Upgrade) {
|
||||
let package_version = parse_package_version();
|
||||
|
||||
let existing_config = Config::load_from_file(Some(&args.id)).unwrap_or_else(|err| {
|
||||
eprintln!("failed to load existing config file! - {:?}", err);
|
||||
eprintln!("failed to load existing config file! - {err}");
|
||||
process::exit(1)
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user