mirror of
https://github.com/kaspanet/kaspad.git
synced 2026-02-20 18:56:56 +00:00
[NOD-416] Use errors.Is and add goroutine stack trace to HandlePanic (#459)
* [NOD-416] Use errors.Is and add goroutine stack trace to HandlePanic * [NOD-416] Don't print goroutineStackTrace if it's nil
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package httpserverutils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"net/http"
|
||||
"runtime/debug"
|
||||
@@ -45,8 +44,7 @@ func RecoveryMiddleware(h http.Handler) http.Handler {
|
||||
} else {
|
||||
recoveryErrAsError = errors.Errorf("%s", recoveryErr)
|
||||
}
|
||||
recoveryErrStr := fmt.Sprintf("%s", recoveryErr)
|
||||
log.Criticalf("Fatal error: %+v", recoveryErrStr)
|
||||
log.Criticalf("Fatal error: %+v", recoveryErrAsError)
|
||||
log.Criticalf("Stack trace: %s", debug.Stack())
|
||||
SendErr(ctx, w, recoveryErrAsError)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user