cli: fix errors format

Error string should not be capitalized or end with punctuation mark.

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
Ekaterina Pavlova 2024-07-12 12:35:10 +03:00
parent fc2798f9d1
commit d4a3c912fb
2 changed files with 9 additions and 9 deletions

View file

@ -80,14 +80,14 @@ func NewCommands() []*cli.Command {
func queryTx(ctx *cli.Context) error { func queryTx(ctx *cli.Context) error {
args := ctx.Args().Slice() args := ctx.Args().Slice()
if len(args) == 0 { if len(args) == 0 {
return cli.Exit("Transaction hash is missing", 1) return cli.Exit("transaction hash is missing", 1)
} else if len(args) > 1 { } else if len(args) > 1 {
return cli.Exit("only one transaction hash is accepted", 1) return cli.Exit("only one transaction hash is accepted", 1)
} }
txHash, err := util.Uint256DecodeStringLE(strings.TrimPrefix(args[0], "0x")) txHash, err := util.Uint256DecodeStringLE(strings.TrimPrefix(args[0], "0x"))
if err != nil { if err != nil {
return cli.Exit(fmt.Sprintf("Invalid tx hash: %s", args[0]), 1) return cli.Exit(fmt.Sprintf("invalid tx hash: %s", args[0]), 1)
} }
gctx, cancel := options.GetTimeoutContext(ctx) gctx, cancel := options.GetTimeoutContext(ctx)
@ -274,7 +274,7 @@ func queryHeight(ctx *cli.Context) error {
func queryVoter(ctx *cli.Context) error { func queryVoter(ctx *cli.Context) error {
args := ctx.Args().Slice() args := ctx.Args().Slice()
if len(args) == 0 { if len(args) == 0 {
return cli.Exit("No address specified", 1) return cli.Exit("no address specified", 1)
} else if len(args) > 1 { } else if len(args) > 1 {
return cli.Exit("this command only accepts one address", 1) return cli.Exit("this command only accepts one address", 1)
} }

View file

@ -402,7 +402,7 @@ func changePassword(ctx *cli.Context) error {
oldPass, err := input.ReadPassword(EnterOldPasswordPrompt) oldPass, err := input.ReadPassword(EnterOldPasswordPrompt)
if err != nil { if err != nil {
return cli.Exit(fmt.Errorf("Error reading old password: %w", err), 1) return cli.Exit(fmt.Errorf("error reading old password: %w", err), 1)
} }
for i := range wall.Accounts { for i := range wall.Accounts {
@ -417,7 +417,7 @@ func changePassword(ctx *cli.Context) error {
pass, err := readNewPassword() pass, err := readNewPassword()
if err != nil { if err != nil {
return cli.Exit(fmt.Errorf("Error reading new password: %w", err), 1) return cli.Exit(fmt.Errorf("error reading new password: %w", err), 1)
} }
for i := range wall.Accounts { for i := range wall.Accounts {
if addrFlag.IsSet && wall.Accounts[i].Address != addrFlag.String() { if addrFlag.IsSet && wall.Accounts[i].Address != addrFlag.String() {
@ -430,7 +430,7 @@ func changePassword(ctx *cli.Context) error {
} }
err = wall.Save() err = wall.Save()
if err != nil { if err != nil {
return cli.Exit(fmt.Errorf("Error saving the wallet: %w", err), 1) return cli.Exit(fmt.Errorf("error saving the wallet: %w", err), 1)
} }
return nil return nil
} }
@ -455,7 +455,7 @@ func convertWallet(ctx *cli.Context) error {
if len(wall.Accounts) != 1 || pass == nil { if len(wall.Accounts) != 1 || pass == nil {
password, err := input.ReadPassword(fmt.Sprintf("Enter password for account %s (label '%s') > ", acc.Address, acc.Label)) password, err := input.ReadPassword(fmt.Sprintf("Enter password for account %s (label '%s') > ", acc.Address, acc.Label))
if err != nil { if err != nil {
return cli.Exit(fmt.Errorf("Error reading password: %w", err), 1) return cli.Exit(fmt.Errorf("error reading password: %w", err), 1)
} }
pass = &password pass = &password
} }
@ -532,7 +532,7 @@ loop:
if pass == nil { if pass == nil {
password, err := input.ReadPassword(EnterPasswordPrompt) password, err := input.ReadPassword(EnterPasswordPrompt)
if err != nil { if err != nil {
return cli.Exit(fmt.Errorf("Error reading password: %w", err), 1) return cli.Exit(fmt.Errorf("error reading password: %w", err), 1)
} }
pass = &password pass = &password
} }
@ -783,7 +783,7 @@ func dumpWallet(ctx *cli.Context) error {
if pass == nil { if pass == nil {
password, err := input.ReadPassword(EnterPasswordPrompt) password, err := input.ReadPassword(EnterPasswordPrompt)
if err != nil { if err != nil {
return cli.Exit(fmt.Errorf("Error reading password: %w", err), 1) return cli.Exit(fmt.Errorf("error reading password: %w", err), 1)
} }
pass = &password pass = &password
} }