v0.0.620
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Has been cancelled

This commit is contained in:
2026-01-08 23:03:55 +01:00
parent 580906ea08
commit 4bebc9ea38
2 changed files with 9 additions and 4 deletions

View File

@@ -3,7 +3,6 @@ package ginext
import (
"fmt"
"net/http"
"strings"
"git.blackforestbytes.com/BlackForestBytes/goext/exerr"
"github.com/gin-gonic/gin"
@@ -42,6 +41,8 @@ func Wrap(w *GinWrapper, fn WHandlerFunc) gin.HandlerFunc {
}
if g.Writer.Written() {
// (!) This panic is not preoperly cached - it will kill the whole process
// but that only means you should NOT write in WrapperFunc...
panic("Writing in WrapperFunc is not supported")
}
@@ -64,7 +65,11 @@ func Wrap(w *GinWrapper, fn WHandlerFunc) gin.HandlerFunc {
wrap.Write(g)
if g.IsAborted() {
// can happen if we try to marshal an invalid json object (e.g. containing Inf)
panic("Failed to write response to renderer:\n" + strings.Join(g.Errors.Errors(), "\n"))
exerr.
New(exerr.TypePanic, "Failed to write response to renderer").
Strs("errors", g.Errors.Errors()).
Stack().
Print(g)
}
}
}