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

Improve Algorithm.String() message for unknown values #167

Merged
merged 1 commit into from
Aug 25, 2023
Merged

Conversation

qmuntal
Copy link
Contributor

@qmuntal qmuntal commented Aug 18, 2023

This PR modifies the Algorithm.String message for values not defined in go-cose.

For example, when calling Algorithm(7).String(), it previously returned unknown algorithm value 7. Considering that other libraries can define their own algorithms, IMO that message is too verbose and seems more like an error than a useful name.
With the new behavior, the returned string will be Algorithm(7).

While here, fix #164.

Signed-off-by: qmuntal <qmuntaldiaz@microsoft.com>
Copy link
Contributor

@OR13 OR13 left a comment

Choose a reason for hiding this comment

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

Much better errors

Copy link
Contributor

@SteveLasker SteveLasker left a comment

Choose a reason for hiding this comment

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

LGTM for more detail surfaced for diagnostics

@SteveLasker
Copy link
Contributor

Thanks @hslatman for the initial PR.

@SteveLasker SteveLasker merged commit da0f9a6 into main Aug 25, 2023
5 checks passed
@qmuntal qmuntal deleted the strerr branch August 25, 2023 15:35
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.

Improve error message for RS256, RS384, RS512 constants
4 participants