in pq/error.go [167:188]
func (e *Error) causedBy(cause error) *Error {
e.cause = cause
other, ok := cause.(*Error)
if !ok {
return e
}
// merge error and cause context such that the cause context only reports
// fields that differ from the current context.
errCtx := &e.ctx
causeCtx := &other.ctx
if errCtx.id == causeCtx.id {
causeCtx.id = 0 // delete common queue id from cause context
}
if errCtx.isPage && causeCtx.isPage && errCtx.page == causeCtx.page {
causeCtx.isPage = false // delete common page id from cause context
}
return e
}