Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algokey: clarify error messages. #3727

Merged
merged 2 commits into from
Apr 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmd/algokey/keyreg.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ func run(params keyregCmdParams) error {
return errors.New("must provide --keyfile when registering participation keys")
}
if params.addr != "" {
return errors.New("do not provide --address when registering participation keys")
return errors.New("do not provide --account when registering participation keys")
}
} else {
if params.addr == "" {
return errors.New("must provide --address when bringing an account offline")
return errors.New("must provide --account when bringing an account offline")
}
if params.partkeyFile != "" {
return errors.New("do not provide --keyfile when bringing an account offline")
Expand All @@ -160,7 +160,7 @@ func run(params keyregCmdParams) error {
var err error
accountAddress, err = basics.UnmarshalChecksumAddress(params.addr)
if err != nil {
return fmt.Errorf("unable to parse --address: %w", err)
return fmt.Errorf("unable to parse --account: %w", err)
}
}

Expand All @@ -172,8 +172,8 @@ func run(params keyregCmdParams) error {
params.txFile = fmt.Sprintf("%s.tx", params.partkeyFile)
}

if util.FileExists(params.txFile) || params.txFile == stdoutFilenameValue {
return fmt.Errorf("outputFile '%s' already exists", params.partkeyFile)
if params.txFile != stdoutFilenameValue && util.FileExists(params.txFile) {
return fmt.Errorf("outputFile '%s' already exists", params.txFile)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message makes sense only for the first case of the conditional. In the second case, you might want to have a separate error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like that expression is wrong. It should be verifying that it is not the stdout filename.

}

// Lookup information from partkey file
Expand Down