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

More consistent way of handling validation errors #274

Merged
merged 9 commits into from
Feb 21, 2023
Merged

Conversation

oxisto
Copy link
Collaborator

@oxisto oxisto commented Feb 19, 2023

This PR removes the mess of the old ValidationError struct and replaces it with either multiple wrapped errors (in case of Go 1.20) or an implementation that emulates that behaviour using internal structs (on Go < 1.20).

It also consistently aborts the validation process now if signature validation fails, which otherwise might lead to unexpected error situations.

validator.go Outdated Show resolved Hide resolved
@oxisto oxisto mentioned this pull request Feb 19, 2023
3 tasks
@oxisto oxisto force-pushed the better-error-handling branch from c6f4c37 to 8c124aa Compare February 20, 2023 14:33
@oxisto oxisto marked this pull request as ready for review February 20, 2023 15:51
@oxisto oxisto requested a review from mfridman February 20, 2023 15:52
none.go Outdated Show resolved Hide resolved
none.go Outdated Show resolved Hide resolved
parser_test.go Outdated Show resolved Hide resolved
@oxisto oxisto changed the title More consistent way of handling composite errors More consistent way of handling validation errors Feb 20, 2023
@oxisto oxisto force-pushed the better-error-handling branch 2 times, most recently from 533550d to 6d0139f Compare February 20, 2023 21:25
@oxisto oxisto force-pushed the better-error-handling branch from a7bf269 to f759348 Compare February 20, 2023 22:01
@oxisto oxisto force-pushed the better-error-handling branch from f759348 to 1cf3c71 Compare February 20, 2023 22:03
Copy link
Member

@mfridman mfridman left a comment

Choose a reason for hiding this comment

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

This is fantastic work!

The new error handling reads a lot better in my opinion and hopefully, in a few releases, we can drop the older error branch and build tags entirely.

errors.go Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@oxisto oxisto merged commit 28dc523 into v5 Feb 21, 2023
@oxisto oxisto deleted the better-error-handling branch February 21, 2023 07:54
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.

Hello, I have two questions for you. Comparison of token parsing errors Please add err.types
2 participants