Skip to content

Commit

Permalink
logging - stop warning on expired oidc tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
edoshor committed Dec 21, 2018
1 parent ccd1a76 commit da45f9c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"net/http"
"runtime/debug"
"strings"
"time"

log "github.com/Sirupsen/logrus"
Expand Down Expand Up @@ -107,8 +108,11 @@ func ErrorHandlingMiddleware() gin.HandlerFunc {
switch e.Type {
case gin.ErrorTypePublic:
if e.Err != nil {
log.Warnf("Public error: %s", e.Error())
c.JSON(c.Writer.Status(), gin.H{"status": "error", "error": e.Error()})
errMsg := e.Error()
if !strings.Contains(errMsg, "oidc: token is expired ") {
log.Warnf("Public error: %s", errMsg)
}
c.JSON(c.Writer.Status(), gin.H{"status": "error", "error": errMsg})
}

case gin.ErrorTypeBind:
Expand Down

0 comments on commit da45f9c

Please sign in to comment.