Skip to content

Commit 1c4047f

Browse files
authored
Adjusting the error checking example (#270)
This PR adjusts the error checking example so that a check for an invalid signature is also included. See discussion in #143
1 parent b357385 commit 1c4047f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

example_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ func ExampleParse_errorChecking() {
164164
fmt.Println("You look nice today")
165165
} else if errors.Is(err, jwt.ErrTokenMalformed) {
166166
fmt.Println("That's not even a token")
167+
} else if errors.Is(err, jwt.ErrTokenSignatureInvalid) {
168+
// Invalid signature
169+
fmt.Println("Invalid signature")
167170
} else if errors.Is(err, jwt.ErrTokenExpired) || errors.Is(err, jwt.ErrTokenNotValidYet) {
168171
// Token is either expired or not active yet
169172
fmt.Println("Timing is everything")

0 commit comments

Comments
 (0)