Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Conversation

@akrylysov
Copy link

@akrylysov akrylysov commented Jul 11, 2016

The default behavior of the default Go http panic handler is to display the error message and the stack trace. When I use raven.RecoveryHandler it outputs only the stack trace, which makes debugging difficult.

Default behavior:

func handler(w http.ResponseWriter, r *http.Request) {
    var x []int
    x[1] = 1
}

func main() {
    http.HandleFunc("/", handler)
    http.ListenAndServe(":8080", nil)
}

2016/07/11 13:49:24 http: panic serving [::1]:50020: runtime error: index out of range
goroutine 25 [running]:
[stack trace]

With RecoveryHandler:

func main() {
    http.HandleFunc("/", raven.RecoveryHandler(handler))
    http.ListenAndServe(":8080", nil)
}

goroutine 21 [running]:
[stack trace]

This pull request makes RecoveryHandler output look like:

2016/07/11 14:19:41 runtime error: index out of range
goroutine 6 [running]:
[stack trace]

This change is Reviewable

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant