File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ package middleware
22
33import (
44 "fmt"
5- "net/http"
6-
75 "github.com/cloudhut/common/rest"
86 "go.uber.org/zap"
7+ "go.uber.org/zap/zapcore"
8+ "net/http"
99)
1010
1111// Recoverer middleware logs unhandled panics and tries to continue running the API
@@ -20,10 +20,13 @@ func (rec *Recoverer) Wrap(next http.Handler) http.Handler {
2020 if err := recover (); err != nil {
2121 w .Header ().Set ("Connection" , "close" )
2222 restErr := & rest.Error {
23- Err : fmt .Errorf ("There was a panic! %s" , err ),
23+ Err : fmt .Errorf ("there was a panic: %s" , err ),
2424 Status : http .StatusInternalServerError ,
2525 Message : "Internal Server Error" ,
2626 IsSilent : false ,
27+ InternalLogs : []zapcore.Field {
28+ zap .Stack ("stack" ),
29+ },
2730 }
2831 rest .SendRESTError (w , r , rec .Logger , restErr )
2932 }
You can’t perform that action at this time.
0 commit comments