Skip to content

Conversation

@bbockelm
Copy link
Collaborator

Captures the underlying package's text-based error and converts it to a first-class named error, allowing us to test with errors.Is(...).

Captures the underlying package's text-based error and converts it to
a first-class named error, allowing us to test with `errors.Is(...)`.
@bbockelm bbockelm linked an issue Jul 25, 2025 that may be closed by this pull request
7 tasks
@bbockelm bbockelm added bug Something isn't working client Issue affecting the OSDF client labels Jul 25, 2025
@bbockelm bbockelm requested a review from h2zh July 25, 2025 02:18
Copy link
Contributor

@h2zh h2zh left a comment

Choose a reason for hiding this comment

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

Approve with optional suggestion.

I think the "how to reset password" prompt should also be added to printConfig func, when password error is detected.

Comment on lines +140 to +145
if errors.Is(attemptErr, config.ErrIncorrectPassword) {
fmt.Fprintln(os.Stderr, "Failed to access local credential file - entered incorrect local decryption password")
fmt.Fprintln(os.Stderr, "If you have forgotten your password, you can reset the local state (deleting all on-disk credentials)")
fmt.Fprintf(os.Stderr, "by running '%s credentials reset-local'\n", os.Args[0])
os.Exit(1)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can use a helper function? For example:

func printPasswordError(err error, actionText string) {
	if errors.Is(err, config.ErrIncorrectPassword) {
		fmt.Fprintf(os.Stderr, "Failed to %s - entered incorrect local decryption password\n", actionText)
		fmt.Fprintln(os.Stderr, "If you have forgotten your password, you can reset the local state (deleting all on-disk credentials)")
		fmt.Fprintf(os.Stderr, "by running '%s credentials reset-local'\n", os.Args[0])
        os.Exit(1)
	} 
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I second creating a helper function, so changes to the text are consistent.

I also suggest adjusting the text like so:

- fmt.Fprintf(os.Stderr, "Failed to %s - entered incorrect local decryption password\n", actionText)
+ fmt.Fprintf(os.Stderr, "Failed to %s - password is incorrect\n", actionText)

Copy link
Contributor

Choose a reason for hiding this comment

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

If password is incorrect is too vague, then maybe password for local credentials is incorrect.

@jhiemstrawisc
Copy link
Member

Pinging @aowen-uwmad on this since I think this has a lot of overlap with #2793 -- can we knock out both with one PR?

@aowen-uwmad
Copy link
Contributor

@jhiemstrawisc , here's what I propose (#2793 (comment)):

The message prompt for creating a new password should be

Please create a new password to protect your local credentials:

and the message prompt for entering the password should be

Please enter the password you created to protect your local credentials:

@aowen-uwmad aowen-uwmad added the Facilitation A request from the RCF's label Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working client Issue affecting the OSDF client Facilitation A request from the RCF's

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client Configuration File Password Incorrect Error Unclear

4 participants