Do not overwrite errors.

This commit is contained in:
Mariano Cano 2021-11-18 19:03:43 -08:00
parent b6ebd118fc
commit aa3fdf8fb9

View file

@ -246,6 +246,9 @@ func New(status int, format string, args ...interface{}) error {
// NewError creates a new http error with the given error and message.
func NewError(status int, err error, format string, args ...interface{}) error {
if _, ok := err.(*Error); ok {
return err
}
msg := fmt.Sprintf(format, args...)
if _, ok := err.(StackTracer); !ok {
err = errors.Wrap(err, msg)