Skip to content

Commit

Permalink
Remove panic for proper error
Browse files Browse the repository at this point in the history
  • Loading branch information
brianp committed May 15, 2024
1 parent e01e5f3 commit 2f7f267
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base_layer/core/src/transactions/key_manager/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ where TBackend: KeyManagerBackend<PublicKey> + 'static
Ok(key)
},
KeyId::Derived { branch, label, index } => match &self.wallet_type {
WalletType::Ledger(_) => panic!(),
WalletType::Ledger(_) => Err(KeyManagerServiceError::LedgerPrivateKeyInaccessible),
WalletType::Software(k, _pk) => {
let km = self
.key_managers
Expand Down
2 changes: 2 additions & 0 deletions base_layer/key_manager/src/key_manager_service/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ pub enum KeyManagerServiceError {
UnknownError(String),
#[error("Ledger error: `{0}`")]
LedgerError(String),
#[error("The Ledger private key cannot be access or read")]
LedgerPrivateKeyInaccessible,
}

impl From<RangeProofError> for KeyManagerServiceError {
Expand Down

0 comments on commit 2f7f267

Please sign in to comment.