// handleParseTokenError is used for error handling of parseToken.
handleParseTokenError is used for error handling of parseToken.
// handleParseTokenError is used for error handling of parseToken .
func handleParseTokenError(c *gin.Context, err error) bool {
	switch errors.Cause(err) {
	case ErrorAuthorizationHeaderIsEmpty, ErrorAuthorizationHeaderIsInvalid:
		c.Status(http.StatusForbidden)
		c.Set(ErrKey, err)
		return true
	}
	validationErr, ok := err.(*jwt.ValidationError)
	if ok && validationErr.Errors == jwt.ValidationErrorExpired {
		c.Status(http.StatusUnauthorized)
		c.Set(ErrKey, ErrorAuthorizationTokenExpired)
		return true
	}
	if err != nil {
		c.Status(http.StatusInternalServerError)
		c.Set(ErrKey, err)
		return true
	}
	return false
}
func handleParseTokenError ( c * gin . Context , err error ) bool { switch errors . Cause ( err ) { case ErrorAuthorizationHeaderIsEmpty , ErrorAuthorizationHeaderIsInvalid : c . Status ( http . StatusForbidden ) c . Set ( ErrKey , err ) return true } validationErr , ok := err . ( * jwt . ValidationError ) if ok && validationErr . Errors == jwt . ValidationErrorExpired { c . Status ( http . StatusUnauthorized ) c . Set ( ErrKey , ErrorAuthorizationTokenExpired ) return true } if err != nil { c . Status ( http . StatusInternalServerError ) c . Set ( ErrKey , err ) return true } return false }
handleParseTokenError is used for error handling of parseToken.
handleParseTokenError is used for error handling of parseToken .