Handle Gin private error recording
This commit is contained in:
@@ -3,8 +3,11 @@ package handler
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"mal/internal/observability"
|
||||
netutil "mal/pkg/net"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func newProxyRequest(ctx context.Context, targetURL string, referer string) (*http.Request, error) {
|
||||
@@ -20,3 +23,9 @@ func newProxyRequest(ctx context.Context, targetURL string, referer string) (*ht
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func recordPrivateGinError(c *gin.Context, err error) {
|
||||
if recorded := c.Error(err).SetType(gin.ErrorTypePrivate); recorded == nil {
|
||||
observability.WarnContext(c.Request.Context(), "gin_error_record_failed", "playback", "", nil, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user