Merge pull request #3389 from nspcc-dev/import-wallet-error

cli: improve wallet read related errors
This commit is contained in:
Anna Shaleva 2024-04-04 14:10:47 +03:00 committed by GitHub
commit f2bb4d455b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -948,14 +948,14 @@ func createAccount(wall *wallet.Wallet, pass *string) error {
func openWallet(ctx *cli.Context, canUseWalletConfig bool) (*wallet.Wallet, *string, error) {
path, pass, err := getWalletPathAndPass(ctx, canUseWalletConfig)
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 == "-" {
return nil, nil, errNoStdin
}
w, err := wallet.NewWalletFromFile(path)
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
}