Skip to content

Commit

Permalink
simplify the default error handler
Browse files Browse the repository at this point in the history
We don't know whether it is used in a Go routine
  • Loading branch information
Greg Weber authored and gregwebs committed Mar 8, 2024
1 parent 374337d commit de3c6f8
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,7 @@ var ErrorHandler func(error) = DefaultErrorHandler

// The DefaultErrorHandler prints the error with log.Printf
func DefaultErrorHandler(err error) {
pe := PanicError{}
if errors.As(err, &pe) {
log.Printf("go routine panic: %+v", err)
} else {
log.Printf("go routine error: %+v", err)
}
log.Printf("%+v", err)
}

// Go is designed to use as an entry point to a go routine.
Expand Down

0 comments on commit de3c6f8

Please sign in to comment.