mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-08 04:11:08 +03:00
Improve errors that confuse new users (#467)
* Make Get coinbase via wallet API error more self-help friendly. Also show the wallet API URL that failed to respond. * spelling and rustfmt nit * more informational output from `grin server stop` * newcomer friendly error when wallet.seed isn't found * grin wallet (info|outputs): better error message
This commit is contained in:
parent
8e6f54779e
commit
30a9c3db1e
5 changed files with 32 additions and 14 deletions
|
@ -356,15 +356,18 @@ fn server_command(server_args: &ArgMatches, global_config: GlobalConfig) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
match daemonize.start() {
|
match daemonize.start() {
|
||||||
Ok(_) => info!(LOGGER, "Grin server succesfully started."),
|
Ok(_) => info!(LOGGER, "Grin server successfully started."),
|
||||||
Err(e) => error!(LOGGER, "Error starting: {}", e),
|
Err(e) => error!(LOGGER, "Error starting: {}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
("stop", _) => println!("TODO, just 'kill $pid' for now."),
|
("stop", _) => println!("TODO. Just 'kill $pid' for now. Maybe /tmp/grin.pid is $pid"),
|
||||||
(cmd, _) => {
|
(cmd, _) => {
|
||||||
println!(":: {:?}", server_args);
|
println!(":: {:?}", server_args);
|
||||||
panic!("Unknown server command '{}', use 'grin help server' for details", cmd);
|
panic!(
|
||||||
}
|
"Unknown server command '{}', use 'grin help server' for details",
|
||||||
|
cmd
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@ pub fn create_coinbase(url: &str, block_fees: &BlockFees) -> Result<CbData, Erro
|
||||||
if let Err(_) = res {
|
if let Err(_) = res {
|
||||||
error!(
|
error!(
|
||||||
LOGGER,
|
LOGGER,
|
||||||
"Failed to get coinbase via wallet API (will retry)..."
|
"Failed to get coinbase from {}. Run grin wallet listen",
|
||||||
|
url
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
res
|
res
|
||||||
|
@ -69,11 +70,15 @@ fn single_send_partial_tx(url: &str, partial_tx: &PartialTx) -> Result<(), Error
|
||||||
req.set_body(json);
|
req.set_body(json);
|
||||||
|
|
||||||
let work = client.request(req);
|
let work = client.request(req);
|
||||||
let _ = core.run(work).and_then(|res|{
|
let _ = core.run(work).and_then(|res| {
|
||||||
if res.status()==hyper::StatusCode::Ok {
|
if res.status() == hyper::StatusCode::Ok {
|
||||||
info!(LOGGER, "Transaction sent successfully");
|
info!(LOGGER, "Transaction sent successfully");
|
||||||
} else {
|
} else {
|
||||||
error!(LOGGER, "Error sending transaction - status: {}", res.status());
|
error!(
|
||||||
|
LOGGER,
|
||||||
|
"Error sending transaction - status: {}",
|
||||||
|
res.status()
|
||||||
|
);
|
||||||
return Err(hyper::Error::Status);
|
return Err(hyper::Error::Status);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -63,7 +63,7 @@ pub fn show_info(config: &WalletConfig, keychain: &Keychain) {
|
||||||
writeln!(t, "{}", title).unwrap();
|
writeln!(t, "{}", title).unwrap();
|
||||||
writeln!(t, "--------------------------").unwrap();
|
writeln!(t, "--------------------------").unwrap();
|
||||||
t.reset().unwrap();
|
t.reset().unwrap();
|
||||||
|
|
||||||
let mut table = table!(
|
let mut table = table!(
|
||||||
[bFG->"Total", FG->amount_to_hr_string(unspent_total+unconfirmed_total)],
|
[bFG->"Total", FG->amount_to_hr_string(unspent_total+unconfirmed_total)],
|
||||||
[bFY->"Awaiting Confirmation", FY->amount_to_hr_string(unconfirmed_total)],
|
[bFY->"Awaiting Confirmation", FY->amount_to_hr_string(unconfirmed_total)],
|
||||||
|
@ -78,6 +78,10 @@ pub fn show_info(config: &WalletConfig, keychain: &Keychain) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Err(_) = result {
|
if let Err(_) = result {
|
||||||
println!("WARNING - Showing local data only - Wallet was unable to contact a node to update and verify the info shown here.");
|
println!(
|
||||||
|
"\nWARNING: Wallet failed to verify data. \
|
||||||
|
The above is from local cache and possibly invalid! \
|
||||||
|
(is your `grin server` offline or broken?)"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,10 @@ pub fn show_outputs(config: &WalletConfig, keychain: &Keychain, show_spent:bool)
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Err(_) = result {
|
if let Err(_) = result {
|
||||||
println!("WARNING - Showing local data only - Wallet was unable to contact a node to update and verify the outputs shown here.");
|
println!(
|
||||||
|
"\nWARNING: Wallet failed to verify data. \
|
||||||
|
The above is from local cache and possibly invalid! \
|
||||||
|
(is your `grin server` offline or broken?)"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,7 +354,10 @@ impl WalletSeed {
|
||||||
LOGGER,
|
LOGGER,
|
||||||
"Run: \"grin wallet init\" to initialize a new wallet.",
|
"Run: \"grin wallet init\" to initialize a new wallet.",
|
||||||
);
|
);
|
||||||
panic!("wallet seed file does not yet exist (grin wallet init)");
|
panic!(format!(
|
||||||
|
"wallet seed file {} could not be opened (grin wallet init)",
|
||||||
|
seed_file_path
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,7 +525,6 @@ impl WalletData {
|
||||||
max_outputs: usize,
|
max_outputs: usize,
|
||||||
default_strategy: bool,
|
default_strategy: bool,
|
||||||
) -> Vec<OutputData> {
|
) -> Vec<OutputData> {
|
||||||
|
|
||||||
// first find all eligible outputs based on number of confirmations
|
// first find all eligible outputs based on number of confirmations
|
||||||
let mut eligible = self.outputs
|
let mut eligible = self.outputs
|
||||||
.values()
|
.values()
|
||||||
|
|
Loading…
Reference in a new issue