Commit 8f6639f8 authored by Gemini Wen's avatar Gemini Wen
Browse files

fix(response): add nil check for c.Request in error logging



Prevents panic when ErrorFrom is called in test contexts where
gin.CreateTestContext doesn't set up an HTTP request.
Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
parent fc17d9d7
......@@ -77,7 +77,7 @@ func ErrorFrom(c *gin.Context, err error) bool {
statusCode, status := infraerrors.ToHTTP(err)
// Log internal errors with full details for debugging
if statusCode >= 500 {
if statusCode >= 500 && c.Request != nil {
log.Printf("[ERROR] %s %s\n Error: %s", c.Request.Method, c.Request.URL.Path, err.Error())
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment