Handle Gin private error recording
This commit is contained in:
@@ -3,8 +3,11 @@ package handler
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"mal/internal/observability"
|
||||||
netutil "mal/pkg/net"
|
netutil "mal/pkg/net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newProxyRequest(ctx context.Context, targetURL string, referer string) (*http.Request, error) {
|
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
|
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