1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
diff --git a/internal/handler/404.go b/internal/handler/404.go
index dd387f7bc07a44578fac69876145d2833bd240f5..c564165b5a41e43c746559913ddc5b53b93d8de2 100644
--- a/internal/handler/404.go
+++ b/internal/handler/404.go
@@ -4,14 +4,19 @@ import (
"errors"
"fmt"
+ "git.sr.ht/~mpldr/gogit/internal/conman"
"github.com/valyala/fasthttp"
)
func errorHandler(ctx *fasthttp.RequestCtx, err error) {
+ log := conman.GetLogger(ctx)
status := fasthttp.StatusInternalServerError
switch {
case errors.Is(err, ErrNotFound):
status = fasthttp.StatusNotFound
+ log.Warn(err.Error(), "path", ctx.Path())
+ default:
+ log.Error("internal server error", "error", err.Error())
}
ctx.SetStatusCode(status)
|