github.com/nalekseevs/itns-golangci-lint@v1.0.2/internal/errorutil/errors.go (about) 1 package errorutil 2 3 import ( 4 "fmt" 5 ) 6 7 // PanicError can be used to not print stacktrace twice 8 type PanicError struct { 9 recovered any 10 stack []byte 11 } 12 13 func NewPanicError(recovered any, stack []byte) *PanicError { 14 return &PanicError{recovered: recovered, stack: stack} 15 } 16 17 func (e PanicError) Error() string { 18 return fmt.Sprint(e.recovered) 19 } 20 21 func (e PanicError) Stack() []byte { 22 return e.stack 23 }