Skip to content

Commit 41f69a3

Browse files
committed
return overwritable error
1 parent db0119d commit 41f69a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

jwt.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const (
114114
)
115115

116116
// ErrJWTMissing denotes an error raised when JWT token value could not be extracted from request
117-
var ErrJWTMissing = echo.NewHTTPError(http.StatusUnauthorized, "missing or malformed jwt")
117+
var ErrJWTMissing = echo.NewHTTPError(http.StatusBadRequest, "missing or malformed jwt")
118118

119119
// ErrJWTInvalid denotes an error raised when JWT token value is invalid or expired
120120
var ErrJWTInvalid = echo.NewHTTPError(http.StatusUnauthorized, "invalid or expired jwt")
@@ -255,10 +255,10 @@ func (config Config) ToMiddleware() (echo.MiddlewareFunc, error) {
255255
}
256256

257257
if lastTokenErr == nil {
258-
return echo.NewHTTPError(http.StatusBadRequest, "missing or malformed jwt").SetInternal(err)
258+
return ErrJWTMissing.WithInternal(err)
259259
}
260260

261-
return echo.NewHTTPError(http.StatusUnauthorized, "invalid or expired jwt").SetInternal(err)
261+
return ErrJWTInvalid.WithInternal(err)
262262
}
263263
}, nil
264264
}

0 commit comments

Comments
 (0)