Skip to content

Commit

Permalink
fixed random error logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirari04 committed Jan 22, 2024
1 parent 2a7fbce commit a65f0bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions inits/Server.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,18 @@ func Server() {
}

app.IPExtractor = echo.ExtractIPFromXFFHeader(trustOptions...)
app.HTTPErrorHandler = func(err error, c echo.Context) {
app.HTTPErrorHandler = func(errors error, c echo.Context) {
code := http.StatusInternalServerError
if he, ok := err.(*echo.HTTPError); ok {
if he, ok := errors.(*echo.HTTPError); ok {
code = he.Code
}
c.Logger().Error(err)

if code == 404 {
if err := c.Render(code, "404.html", echo.Map{}); err != nil {
c.Logger().Error(err)
}
} else {
c.Logger().Error(errors)
c.NoContent(code)
}
}
Expand Down

0 comments on commit a65f0bc

Please sign in to comment.