From b34c0c7048237cd1b36b1cfd3e88800c0baeb721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dj8yf0=CE=BCl?= Date: Tue, 21 Nov 2023 15:25:31 +0200 Subject: [PATCH] chore: error msg-s in known cases --- .../sign_with_ledger/mod.rs | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/transaction_signature_options/sign_with_ledger/mod.rs b/src/transaction_signature_options/sign_with_ledger/mod.rs index b5d07e489..8830f8337 100644 --- a/src/transaction_signature_options/sign_with_ledger/mod.rs +++ b/src/transaction_signature_options/sign_with_ledger/mod.rs @@ -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)