File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ mod tests {
237
237
238
238
// load and decrypt
239
239
let decrypted = AccountSecretKey :: from_encrypted_file ( & tmp_path, password)
240
- . expect ( "Failed to decrypt secret key file" ) ;
240
+ . unwrap_or_else ( |_| panic ! ( "Failed to decrypt secret key file: {}" , tmp_path ) ) ;
241
241
242
242
assert_eq ! (
243
243
new_key. public_key( ) ,
@@ -252,7 +252,7 @@ mod tests {
252
252
let key_path = "../tests/files/accounts/test-key-1" ;
253
253
let expected_public_key = "B62qmg7n4XqU3SFwx9KD9B7gxsKwxJP5GmxtBpHp1uxyN3grujii9a1" ;
254
254
let decrypted = AccountSecretKey :: from_encrypted_file ( key_path, password)
255
- . expect ( "Failed to decrypt secret key file" ) ;
255
+ . unwrap_or_else ( |_| panic ! ( "Failed to decrypt secret key file: {}" , key_path ) ) ;
256
256
257
257
assert_eq ! (
258
258
expected_public_key. to_string( ) ,
Original file line number Diff line number Diff line change @@ -213,8 +213,12 @@ impl NodeBuilder {
213
213
password : & str ,
214
214
provers : Option < BlockProver > ,
215
215
) -> anyhow:: Result < & mut Self > {
216
- let key = AccountSecretKey :: from_encrypted_file ( path, password)
217
- . context ( "Failed to decrypt secret key file" ) ?;
216
+ let key = AccountSecretKey :: from_encrypted_file ( & path, password) . with_context ( || {
217
+ format ! (
218
+ "Failed to decrypt secret key file: {}" ,
219
+ path. as_ref( ) . display( )
220
+ )
221
+ } ) ?;
218
222
Ok ( self . block_producer ( key, provers) )
219
223
}
220
224
Original file line number Diff line number Diff line change @@ -295,7 +295,7 @@ mod tests {
295
295
let expected_peer_id = "12D3KooWDxyuJKSsVEwNR13UVwf4PEfs4yHkk3ecZipBPv3Y3Sac" ;
296
296
297
297
let decrypted = SecretKey :: from_encrypted_file ( key_path, password)
298
- . expect ( "Failed to decrypt secret key file" ) ;
298
+ . unwrap_or_else ( |_| panic ! ( "Failed to decrypt secret key file: {}" , key_path ) ) ;
299
299
300
300
let peer_id = decrypted. public_key ( ) . peer_id ( ) . to_libp2p_string ( ) ;
301
301
assert_eq ! ( expected_peer_id, peer_id) ;
You can’t perform that action at this time.
0 commit comments