Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
CLI/Keygen - fix shell return value on error
Browse files Browse the repository at this point in the history
  • Loading branch information
t-nelson committed Mar 12, 2020
1 parent e7da4da commit 2c21011
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,19 @@ fn main() -> Result<(), Box<dyn error::Error>> {
.get_matches();

if let Err(e) = do_main(&matches) {
eprintln!("error: {}", e);
use thiserror::Error;

#[derive(Error)]
#[error("")]
struct PrettyError(String);

impl std::fmt::Debug for PrettyError {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(fmt, "{}", self.0)
}
}

return Err(PrettyError(e.to_string()).into());
}
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions keygen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ solana-clap-utils = { path = "../clap-utils", version = "1.1.0" }
solana-cli-config = { path = "../cli-config", version = "1.1.0" }
solana-remote-wallet = { path = "../remote-wallet", version = "1.1.0" }
solana-sdk = { path = "../sdk", version = "1.1.0" }
thiserror = "1.0.11"
tiny-bip39 = "0.7.0"

[[bin]]
Expand Down
14 changes: 13 additions & 1 deletion keygen/src/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,19 @@ fn grind_parse_args(
fn main() -> Result<(), Box<dyn error::Error>> {
let result = do_main().err();
if let Some(err) = result {
eprintln!("hi! {}", err);
use thiserror::Error;

#[derive(Error)]
#[error("")]
struct PrettyError(String);

impl std::fmt::Debug for PrettyError {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(fmt, "{}", self.0)
}
}

return Err(PrettyError(err.to_string()).into());
}
Ok(())
}
Expand Down

0 comments on commit 2c21011

Please sign in to comment.