Skip to content

Improve error message for invalid private keys#195

Merged
jsha merged 1 commit intogo-jose:mainfrom
ProjectMutilation:fix-logic-error
Jul 17, 2025
Merged

Improve error message for invalid private keys#195
jsha merged 1 commit intogo-jose:mainfrom
ProjectMutilation:fix-logic-error

Conversation

@ProjectMutilation
Copy link
Copy Markdown
Contributor

The switch statement is exited subsequent to the first condition that evaluates to true, yet it is evident from the context that the intention was to cover all possibilities.

Found by PostgresPro
Fixes: 98e5a54 ("Print all missing fields at once")

@mcpherrinm
Copy link
Copy Markdown
Collaborator

Thanks for the PR!

The same error exists in edPrivateKey().

ecPrivateKey(), ecPublicKey, and rsaPublicKey also doesn't print which fields are missing, just that one is missing.

Would you like to make all of these use the same pattern here? I'm happy to do it myself if you don't want to, so just let me know.

@ProjectMutilation
Copy link
Copy Markdown
Contributor Author

@mcpherrinm yep, i will fix it

@mcpherrinm
Copy link
Copy Markdown
Collaborator

Thanks! One more minor problem, can you go fmt this file? (Sorry, we don't have a CI check for that right now)

The switch statement is exited subsequent to the first condition that evaluates to true,
yet it is evident from the context that the intention was to cover all possibilities.

Found by PostgresPro
Fixes: 98e5a54 ("Print all missing fields at once")
Signed-off-by: Maksim Korotkov <m.korotkov@postgrespro.ru>
@ProjectMutilation
Copy link
Copy Markdown
Contributor Author

ProjectMutilation commented Jul 4, 2025

minor problem

My bad, fixed

@mcpherrinm mcpherrinm changed the title Fix logic error Improve error message for invalid private keys Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants