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

Please add err.types #64

Closed
lggomez opened this issue Aug 3, 2021 · 4 comments · Fixed by #274
Closed

Please add err.types #64

lggomez opened this issue Aug 3, 2021 · 4 comments · Fixed by #274
Labels
enhancement New feature or request jwt-go: legacy

Comments

@lggomez
Copy link
Member

lggomez commented Aug 3, 2021

Migrated from dgrijalva/jwt-go#375:

Filet-de-S commented on Jan 18, 2020 •

It's inconvenient to check it with strcmp instead of switch err.(type)

*jwt.ValidationError is the same for "invalid signature" as for any other like from custom Valid() method. It would be great if we could set it manually. Thanks.

@lggomez lggomez added enhancement New feature or request jwt-go: legacy labels Aug 3, 2021
@lggomez
Copy link
Member Author

lggomez commented Aug 3, 2021

A further improvement aside from splitting ValidationError into derived types would be making them 1.13 compliant (that is, compatible with the Is/As and Unwrap errors package methods). That would make the refactor worth it and allow for error type assertions in a more idiomatic way than type swtiching

@oxisto
Copy link
Collaborator

oxisto commented Aug 3, 2021

A further improvement aside from splitting ValidationError into derived types would be making them 1.13 compliant (that is, compatible with the Is/As and Unwrap errors package methods). That would make the refactor worth it and allow for error type assertions in a more idiomatic way than type swtiching

I agree, I would also like to go the 1.13 error types route.

@chowey
Copy link

chowey commented Oct 16, 2021

I have trouble with this too. It seems like the fix is simple: add an Unwrap method in errors.go:

func (e ValidationError) Unwrap() error {
    return e.Inner
}

@oxisto oxisto linked a pull request Feb 20, 2023 that will close this issue
@oxisto
Copy link
Collaborator

oxisto commented Feb 21, 2023

Fixed by #234

@oxisto oxisto closed this as completed Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request jwt-go: legacy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants