File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use massa_models::{
12
12
} ;
13
13
use massa_signature:: { generate_random_private_key, PrivateKey , PublicKey } ;
14
14
use massa_time:: MassaTime ;
15
- use massa_wallet:: Wallet ;
15
+ use massa_wallet:: { Wallet , WalletError } ;
16
16
use serde:: Serialize ;
17
17
use std:: collections:: HashMap ;
18
18
use std:: fmt:: { Debug , Display } ;
@@ -474,8 +474,14 @@ impl Command {
474
474
Ok ( _) => {
475
475
res. push_str ( & format ! ( "Removed address {} from the wallet\n " , key) ) ;
476
476
}
477
- Err ( err) => {
478
- res. push_str ( & err. to_string ( ) ) ;
477
+ Err ( WalletError :: MissingKeyError ( _) ) => {
478
+ res. push_str ( & format ! ( "Address {} wasn't in the wallet\n " , key) ) ;
479
+ }
480
+ Err ( _) => {
481
+ res. push_str ( & format ! (
482
+ "Failed to remove address {} from the wallet\n " ,
483
+ key
484
+ ) ) ;
479
485
}
480
486
}
481
487
}
Original file line number Diff line number Diff line change @@ -78,7 +78,9 @@ impl Wallet {
78
78
}
79
79
80
80
pub fn remove_address ( & mut self , address : Address ) -> Result < ( ) , WalletError > {
81
- self . keys . remove ( & address) . ok_or ( WalletError :: MissingKeyError ( address) ) ?;
81
+ self . keys
82
+ . remove ( & address)
83
+ . ok_or ( WalletError :: MissingKeyError ( address) ) ?;
82
84
self . save ( )
83
85
}
84
86
You can’t perform that action at this time.
0 commit comments