Skip to content

Commit

Permalink
chore: Add formatted log when recovering from a panic
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed May 1, 2024
1 parent 8c9b0be commit c0097d2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func main() {
var status int
if msg := recover(); msg != nil {
status = 1
log.Error().Interface("error", msg).Msg("recovered from panic")
err = fmt.Errorf("%w: %v\n\n%s", errPanic, msg, string(debug.Stack()))
_, _ = io.WriteString(os.Stderr, err.Error())
}
Expand Down

0 comments on commit c0097d2

Please sign in to comment.