Skip to content

Commit

Permalink
fix: response when recovery from panic
Browse files Browse the repository at this point in the history
  • Loading branch information
ken109 committed Nov 22, 2021
1 parent e3425f5 commit 89c40a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions http/middleware/log.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package middleware

import (
"fmt"
"net"
"net/http"
"net/http/httputil"
"os"
"runtime/debug"
"strings"
"time"

"github.com/gin-gonic/gin"
"github.com/nimil-jp/gin-utils/errors"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -105,7 +106,8 @@ func RecoveryWithLog(logger *zap.Logger, stack bool) gin.HandlerFunc {
zap.String("request", string(httpRequest)),
)
}
c.AbortWithStatus(http.StatusInternalServerError)

errors.NewUnexpected(fmt.Errorf("%+v", err)).Response().Do(c, c.Writer.Header().Get("X-Request-Id"))
}
}()
c.Next()
Expand Down

0 comments on commit 89c40a4

Please sign in to comment.