Skip to content

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

Merged
SteveLasker merged 1 commit intomainfrom
strerr
Aug 25, 2023
Merged

Improve Algorithm.String() message for unknown values#167
SteveLasker merged 1 commit intomainfrom
strerr

Conversation

@qmuntal
Copy link
Copy Markdown
Member

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Thanks @hslatman for the initial PR.

@SteveLasker SteveLasker merged commit da0f9a6 into main Aug 25, 2023
@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