Skip to content

Commit

Permalink
feat: remove log print
Browse files Browse the repository at this point in the history
  • Loading branch information
myml committed Jan 24, 2022
1 parent 9e776b5 commit 25d5d2b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions error_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ginerror
import (
"errors"
"fmt"
"log"
"net/http"
"runtime"

Expand Down Expand Up @@ -67,7 +66,6 @@ func ErrorHandle(logger *zap.Logger, customHandle func(c *gin.Context, err error
requestID := uuid.New()

var es ErrorStack
log.Println(errors.As(err, &es))
if errors.As(err.Err, &es) {
logger.Error("ErrorHandle",
zap.String("requestID", requestID.String()),
Expand All @@ -83,6 +81,9 @@ func ErrorHandle(logger *zap.Logger, customHandle func(c *gin.Context, err error
zap.Error(err),
)
}
if c.Writer.Status() != 0 {
return
}

if errors.Is(err.Err, gorm.ErrRecordNotFound) {
c.JSON(http.StatusNotFound, gin.H{
Expand Down

0 comments on commit 25d5d2b

Please sign in to comment.