Add error logging in middleware
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -3,6 +3,7 @@ package middleware
|
|||||||
import (
|
import (
|
||||||
"git.itzana.me/strafesnet/go-grpc/dev"
|
"git.itzana.me/strafesnet/go-grpc/dev"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -40,6 +41,9 @@ func ValidateRequest(service, permission string, conn *grpc.ClientConn) gin.Hand
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.JSON(http.StatusInternalServerError, gin.H{"error": ErrMsgInternalServer})
|
ctx.JSON(http.StatusInternalServerError, gin.H{"error": ErrMsgInternalServer})
|
||||||
ctx.Abort()
|
ctx.Abort()
|
||||||
|
log.WithError(err).Error(
|
||||||
|
"failed to validate API key",
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user