Skip to content

Commit

Permalink
Make the recover() handler always return a stack trace
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksontj committed Sep 28, 2018
1 parent 7bd25d6 commit 928cb99
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,8 @@ func NewApacheLoggingHandler(handler http.Handler, logHandlers ...LogRecordHandl
func (h *ApacheLoggingHandler) runHandler(rw http.ResponseWriter, r *http.Request) (err error) {
defer func() {
if rec := recover(); rec != nil {
var ok bool
err, ok = rec.(error)
if !ok {
err = errors.Wrap(fmt.Errorf(string(debug.Stack())), "Error running handler")
}
// Just return a stack trace always
err = errors.Wrap(fmt.Errorf(string(debug.Stack())), "Error running handler")
}
}()
h.handler.ServeHTTP(rw, r)
Expand Down

0 comments on commit 928cb99

Please sign in to comment.