forked from TrueCloudLab/certificates
Do not overwrite errors.
This commit is contained in:
parent
b6ebd118fc
commit
aa3fdf8fb9
1 changed files with 3 additions and 0 deletions
|
@ -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.
|
// NewError creates a new http error with the given error and message.
|
||||||
func NewError(status int, err error, format string, args ...interface{}) error {
|
func NewError(status int, err error, format string, args ...interface{}) error {
|
||||||
|
if _, ok := err.(*Error); ok {
|
||||||
|
return err
|
||||||
|
}
|
||||||
msg := fmt.Sprintf(format, args...)
|
msg := fmt.Sprintf(format, args...)
|
||||||
if _, ok := err.(StackTracer); !ok {
|
if _, ok := err.(StackTracer); !ok {
|
||||||
err = errors.Wrap(err, msg)
|
err = errors.Wrap(err, msg)
|
||||||
|
|
Loading…
Reference in a new issue