Replace failure with thiserror (#654)

* updated util and libwallet with thiserror

* update impl crate to thiserror

* api crate converted to thiserror

* update of controller crate to thiserror

* update final bin + tests to thiserror

* update unused import

* remove failure derive

* reset import of grin to master

* update cargo lock

* update from master
This commit is contained in:
Yeastplume
2022-07-28 10:21:45 +01:00
committed by GitHub
parent 67f0e2b0e0
commit 64cab53b1b
63 changed files with 1066 additions and 1586 deletions
+9 -11
View File
@@ -18,7 +18,7 @@ use crate::api::TLSConfig;
use crate::apiwallet::{try_slatepack_sync_workflow, Owner};
use crate::config::{TorConfig, WalletConfig, WALLET_CONFIG_FILE_NAME};
use crate::core::{core, global};
use crate::error::{Error, ErrorKind};
use crate::error::Error;
use crate::impls::PathToSlatepack;
use crate::impls::SlateGetter as _;
use crate::keychain;
@@ -184,7 +184,6 @@ where
}
Err(e) => {
error!("View wallet check failed: {}", e);
error!("Backtrace: {}", e.backtrace().unwrap());
Err(e)
}
}
@@ -235,7 +234,7 @@ where
let r = t.join();
if let Err(_) = r {
error!("Error starting listener");
return Err(ErrorKind::ListenerError.into());
return Err(Error::ListenerError);
}
}
}
@@ -269,7 +268,7 @@ where
test_mode,
);
if let Err(e) = res {
return Err(ErrorKind::LibWallet(e.kind(), e.cause_string()).into());
return Err(Error::LibWallet(e));
}
Ok(())
}
@@ -299,7 +298,7 @@ where
});
if let Err(e) = res {
error!("Error listing accounts: {}", e);
return Err(ErrorKind::LibWallet(e.kind(), e.cause_string()).into());
return Err(Error::LibWallet(e));
}
} else {
let label = args.create.unwrap();
@@ -312,7 +311,7 @@ where
if let Err(e) = res {
thread::sleep(Duration::from_millis(200));
error!("Error creating account '{}': {}", label, e);
return Err(ErrorKind::LibWallet(e.kind(), e.cause_string()).into());
return Err(Error::LibWallet(e));
}
}
Ok(())
@@ -616,7 +615,7 @@ where
}
None => {
let msg = "No slate provided via file or direct input";
return Err(ErrorKind::GenericError(msg.into()).into());
return Err(Error::GenericError(msg.into()).into());
}
}
slate
@@ -740,7 +739,7 @@ where
sp
}
None => {
return Err(ErrorKind::ArgumentError("Invalid Slatepack Input".into()).into());
return Err(Error::ArgumentError("Invalid Slatepack Input".into()).into());
}
},
};
@@ -1343,7 +1342,6 @@ where
}
Err(e) => {
error!("Wallet check failed: {}", e);
error!("Backtrace: {}", e.backtrace().unwrap());
Err(e)
}
}
@@ -1436,7 +1434,7 @@ where
"Unable to open payment proof file at {}: {}",
args.input_file, e
);
return Err(libwallet::ErrorKind::PaymentProofParsing(msg).into());
return Err(libwallet::Error::PaymentProofParsing(msg));
}
};
let mut proof = String::new();
@@ -1447,7 +1445,7 @@ where
Err(e) => {
let msg = format!("{}", e);
error!("Unable to parse payment proof file: {}", e);
return Err(libwallet::ErrorKind::PaymentProofParsing(msg).into());
return Err(libwallet::Error::PaymentProofParsing(msg));
}
};
let result = api.verify_payment_proof(m, &proof);