Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Add detailed diagnostics for blob write failures

Matt Roberts0859bdf0f7b2
diff --git a/app/pkg/web/context.go b/app/pkg/web/context.go
index a4fc17c08..0accfe934 100644
--- a/app/pkg/web/context.go
+++ b/app/pkg/web/context.go
@@ -492,6 +492,16 @@ func (c *Context) Blob(code int, contentType string, b []byte) error {
_, err := c.Response.Write(b)
if err != nil {
+ elapsed := time.Since(c.Request.StartTime)
+ log.Errorf(c, "Failed to write blob response: @{Error} | URL: @{URL} | Method: @{Method} | ContentType: @{ContentType} | BlobSize: @{BlobSize} bytes | StatusCode: @{StatusCode} | Elapsed: @{Elapsed}ms", dto.Props{
+ "Error": err.Error(),
+ "URL": c.Request.URL.String(),
+ "Method": c.Request.Method,
+ "ContentType": contentType,
+ "BlobSize": len(b),
+ "StatusCode": code,
+ "Elapsed": elapsed.Milliseconds(),
+ })
return errors.Wrap(err, "failed to write response")
}