Improved receive error handling

Better errors and messages returned by the push tx API. And better
message in the command line receive. Fixes #585
This commit is contained in:
Ignotus Peverell
2018-01-06 23:27:21 +00:00
parent abcecd82c1
commit 3515bf748c
3 changed files with 31 additions and 8 deletions
+9 -1
View File
@@ -435,7 +435,15 @@ fn wallet_command(wallet_args: &ArgMatches, global_config: GlobalConfig) {
file.read_to_string(&mut contents).expect(
"Unable to read transaction file.",
);
wallet::receive_json_tx_str(&wallet_config, &keychain, contents.as_str()).unwrap();
if let Err(e) =
wallet::receive_json_tx_str(
&wallet_config, &keychain, contents.as_str()) {
println!("Error receiving transaction, the most likely reasons are:");
println!(" * the transaction has already been sent");
println!(" * your node isn't running or can't be reached");
println!("\nDetailed error: {:?}", e);
}
}
("send", Some(send_args)) => {
let amount = send_args.value_of("amount").expect(