Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

make sure all caught panics have a stack with them #1176

Merged
merged 4 commits into from
Jul 16, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ func (a *App) PanicHandler(next Handler) Handler {
if r != nil { //catch
switch t := r.(type) {
case error:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might have to do err = t otherwise err is nill still

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

err = errors.WithStack(t)
case string:
err = errors.WithStack(errors.New(t))
err = errors.New(t)
default:
err = errors.New(fmt.Sprint(t))
}
err = errors.WithStack(err)
eh := a.ErrorHandlers.Get(500)
eh(500, err, c)
}
Expand Down