We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
func anotherHandlerThatPanics() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { _ = 90 someSlice := []string{"zero", "one", "two"} _ = "kilo" _ = someSlice[16] // panic fmt.Fprint(w, "anotherHandlerThatPanics") } } test { logOutput := &bytes.Buffer{} wrappedHandler := Panic(anotherHandlerThatPanics(), getLogger(logOutput)) rec := httptest.NewRecorder() req := httptest.NewRequest(http.MethodGet, "/someUri", nil) wrappedHandler.ServeHTTP(rec, req) res := rec.Result() defer res.Body.Close() attest.Equal(t, res.StatusCode, http.StatusInternalServerError) // attest.Zero(t, logOutput.String()) fmt.Println("logOutput.String():::") fmt.Println(logOutput.String()) } // { "code":500,"err":"runtime error: index out of range [16] with length 3", "level":"error", "line":"/home/komuw/mystuff/ong/middleware/panic.go:50", "logID":"xrZKzxpH7XMtkegRMmTQ8w", "method":"GET", "path":"/someUri", "pid":1349746, "requestAddr":"192.0.2.1:1234", "status":"Internal Server Error", "timestamp":"2022-10-21T07:05:20.778620076Z" }
The text was updated successfully, but these errors were encountered:
issues/162: Panic middleware should include correct stack trace. (#164)
3409841
What: - Panic middleware should include correct stack trace. Why: - Fixes: #162
Successfully merging a pull request may close this issue.
The text was updated successfully, but these errors were encountered: