File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,8 +44,7 @@ export class ConfigActions extends BaseAction {
4444 return ;
4545 }
4646
47- delete config [ key ] ;
48- this . writeConfig ( key , undefined ) ;
47+ this . removeConfig ( key ) ;
4948 this . succeedSpinner ( `Configuration successfully reset` ) ;
5049 }
5150}
Original file line number Diff line number Diff line change @@ -91,8 +91,14 @@ export class BaseAction extends ConfigFileManager {
9191
9292 return wallet . privateKey ;
9393 } catch ( error ) {
94+ const message = error instanceof Error ? error . message : String ( error ) ;
95+ const isPasswordError = / p a s s w o r d | d e c r y p t / i. test ( message ) ;
96+ if ( ! isPasswordError ) {
97+ throw error ;
98+ }
9499 if ( attempt >= BaseAction . MAX_PASSWORD_ATTEMPTS ) {
95100 this . failSpinner ( `Maximum password attempts exceeded (${ BaseAction . MAX_PASSWORD_ATTEMPTS } /${ BaseAction . MAX_PASSWORD_ATTEMPTS } ).` ) ;
101+ throw new Error ( "Maximum password attempts exceeded" ) ;
96102 }
97103 return await this . decryptKeystore ( keystoreJson , attempt + 1 ) ;
98104 }
@@ -149,6 +155,10 @@ export class BaseAction extends ConfigFileManager {
149155 if ( ! existsSync ( keystorePath ) ) {
150156 await this . confirmPrompt ( `Account '${ accountName } ' not found. Would you like to create it?` ) ;
151157 decryptedPrivateKey = await this . createKeypairByName ( accountName , false ) ;
158+ if ( ! existsSync ( keystorePath ) ) {
159+ this . failSpinner ( `Failed to create keystore file for account '${ accountName } '.` , undefined , false ) ;
160+ throw new Error ( `Failed to create keystore file for account '${ accountName } '.` ) ;
161+ }
152162 }
153163
154164 keystoreJson = readFileSync ( keystorePath , "utf-8" ) ;
You can’t perform that action at this time.
0 commit comments