func()

in errors.go [173:196]


func (e *Error) causedBy(cause error) *Error {
	e.cause = cause
	other, ok := cause.(*Error)
	if !ok {
		return e
	}

	errCtx := &e.ctx
	causeCtx := &other.ctx
	if errCtx.file == causeCtx.file {
		causeCtx.file = ""
	}
	if errCtx.isTx && causeCtx.isTx && errCtx.txid == causeCtx.txid {
		causeCtx.isTx = false // delete common tx id from cause context
	}
	if errCtx.isPage && causeCtx.isPage && errCtx.page == causeCtx.page {
		causeCtx.isPage = false // delete common page id from cause context
	}
	if errCtx.isOff && causeCtx.isOff && errCtx.offset == causeCtx.offset {
		causeCtx.isOff = false // delete common page id from cause context
	}

	return e
}