Skip to content

Commit

Permalink
fix(cli): more descriptive error
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevbirb committed Oct 31, 2024
1 parent 0398974 commit cc2e330
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bolt-cli/src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ pub mod signing;
/// Parse a BLS public key from a string
pub fn parse_bls_public_key(delegatee_pubkey: &str) -> Result<BlsPublicKey> {
let hex_pk = delegatee_pubkey.strip_prefix("0x").unwrap_or(delegatee_pubkey);
BlsPublicKey::try_from(hex::decode(hex_pk).wrap_err("Failed to hex-decode pubkey")?.as_slice())
.map_err(|e| eyre::eyre!("Failed to parse public key '{}': {}", hex_pk, e))
BlsPublicKey::try_from(
hex::decode(hex_pk).wrap_err("Failed to hex-decode delegatee pubkey")?.as_slice(),
)
.map_err(|e| eyre::eyre!("Failed to parse delegatee public key '{}': {}", hex_pk, e))
}

/// Write some serializable data to an output json file
Expand Down

0 comments on commit cc2e330

Please sign in to comment.