Merge pull request #3389 from nspcc-dev/import-wallet-error
cli: improve wallet read related errors
This commit is contained in:
commit
f2bb4d455b
1 changed files with 2 additions and 2 deletions
|
@ -948,14 +948,14 @@ func createAccount(wall *wallet.Wallet, pass *string) error {
|
||||||
func openWallet(ctx *cli.Context, canUseWalletConfig bool) (*wallet.Wallet, *string, error) {
|
func openWallet(ctx *cli.Context, canUseWalletConfig bool) (*wallet.Wallet, *string, error) {
|
||||||
path, pass, err := getWalletPathAndPass(ctx, canUseWalletConfig)
|
path, pass, err := getWalletPathAndPass(ctx, canUseWalletConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, cli.NewExitError(fmt.Errorf("failed to get wallet path or password: %w", err), 1)
|
||||||
}
|
}
|
||||||
if path == "-" {
|
if path == "-" {
|
||||||
return nil, nil, errNoStdin
|
return nil, nil, errNoStdin
|
||||||
}
|
}
|
||||||
w, err := wallet.NewWalletFromFile(path)
|
w, err := wallet.NewWalletFromFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, cli.NewExitError(fmt.Errorf("failed to read wallet: %w", err), 1)
|
||||||
}
|
}
|
||||||
return w, pass, nil
|
return w, pass, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue