Browse Source

Log context errors if present.

template-theme-rewrite
Benjamin Shelton 6 months ago
parent
commit
36c3f5710a
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      route.go

+ 6
- 0
route.go View File

@@ -11,6 +11,7 @@ import (
"git.destrealm.org/go/capstan/render"
"git.destrealm.org/go/capstan/status"
"git.destrealm.org/go/errors"
"git.destrealm.org/go/logging"
"github.com/gorilla/websocket"
)

@@ -326,10 +327,15 @@ func (rt *Route) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}

ERRTYPES:
logger := logging.MustInheritLogger("web.errors", "web")

switch err.(type) {
case Context:
if ctx.Code() >= 400 {
rt.router.HTTPError(ctx)
if e := ctx.HasError(); e != nil {
logger.Warning(e)
}
}
case *ce.Redirect:
if e, ok := err.(*ce.Redirect); ok {


Loading…
Cancel
Save