golangci-lint/internal/errorutil/errors.go

24 lines
403 B
Go
Raw Permalink Normal View History

package errorutil
2019-09-27 20:58:49 -04:00
import (
"fmt"
)
// PanicError can be used to not print stacktrace twice
type PanicError struct {
recovered any
stack []byte
}
func NewPanicError(recovered any, stack []byte) *PanicError {
return &PanicError{recovered: recovered, stack: stack}
}
func (e PanicError) Error() string {
return fmt.Sprint(e.recovered)
}
func (e PanicError) Stack() []byte {
return e.stack
}