Fix logging messages for wrapped errors
@@ -37,7 +37,7 @@ func Equals(a, b error) bool {
return a == b
}
return aerr.synopsis == berr.synopsis &&
- strings.Join(aerr.kinds, "") == strings.Join(aerr.kinds, "")
+ strings.Join(aerr.kinds, "") == strings.Join(berr.kinds, "")
}
// Status configures the http status-code which will be
@@ -107,8 +107,15 @@ func (e *Error) LogError() string {
msg := appendMsg(e.synopsis, e.label, e.message)
if e.inner != nil {
+ if innr, ok := e.inner.(*Error); ok {
+ if Equals(e, innr) {
+ innr.synopsis = "" // at least for one level, prevent duplicated synopsis
+ }
+ return appendMsg(msg, innr.LogError())
+ }
msg = appendMsg(msg, e.inner.Error())
}
+
return msg
}
