Skip to content

Commit

Permalink
chore: error msg-s in known cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dj8yf0μl committed Nov 21, 2023
1 parent 9e5f319 commit b34c0c7
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/transaction_signature_options/sign_with_ledger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,24 @@ impl SignLedgerContext {
);
let result = near_ledger::blind_sign_transaction(hash, hd_path);
let signature = result.map_err(|err| {
color_eyre::Report::msg(format!(
"Error occurred while signing the transaction: {:?}",
err
))
match err {
near_ledger::NEARLedgerError::BlindSignatureDisabled => {
color_eyre::Report::msg(format!(
"Blind signature is disabled in NEAR app's settings on Ledger device",
))
},
near_ledger::NEARLedgerError::BlindSignatureNotSupported => {
color_eyre::Report::msg(format!(
"Blind signature is not supported by the version of NEAR app installed on Ledger device",
))
},
err @ _ => {
color_eyre::Report::msg(format!(
"Error occurred while signing the transaction: {:?}",
err
))
}
}
})?;
let signature =
near_crypto::Signature::from_parts(near_crypto::KeyType::ED25519, &signature)
Expand Down

0 comments on commit b34c0c7

Please sign in to comment.