Skip to content

Commit a32d7af

Browse files
authored
Wrap errors with %w instead of %v (#68)
1 parent d30d7b9 commit a32d7af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jwtmiddleware.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func (m *JWTMiddleware) CheckJWT(w http.ResponseWriter, r *http.Request) error {
181181
// If an error occurs, call the error handler and return an error
182182
if err != nil {
183183
m.Options.ErrorHandler(w, r, err.Error())
184-
return fmt.Errorf("Error extracting token: %v", err)
184+
return fmt.Errorf("Error extracting token: %w", err)
185185
}
186186

187187
// If the token is empty...
@@ -207,7 +207,7 @@ func (m *JWTMiddleware) CheckJWT(w http.ResponseWriter, r *http.Request) error {
207207
if err != nil {
208208
m.logf("Error parsing token: %v", err)
209209
m.Options.ErrorHandler(w, r, err.Error())
210-
return fmt.Errorf("Error parsing token: %v", err)
210+
return fmt.Errorf("Error parsing token: %w", err)
211211
}
212212

213213
if m.Options.SigningMethod != nil && m.Options.SigningMethod.Alg() != parsedToken.Header["alg"] {

0 commit comments

Comments
 (0)