WithAttributes returns the error with the given attributes set. Any conflicting attributes in the Error will be overwritten.
(kv ...any)
| 102 | // WithAttributes returns the error with the given attributes set. |
| 103 | // Any conflicting attributes in the Error will be overwritten. |
| 104 | func (e *Error) WithAttributes(kv ...any) *Error { |
| 105 | if e == nil { |
| 106 | return e |
| 107 | } |
| 108 | deriv := *e |
| 109 | deriv.mergeAttributes(kv...) |
| 110 | return &deriv |
| 111 | } |
| 112 | |
| 113 | // WithAttributes returns a new error from the definition, and sets the given attributes. |
| 114 | func (d *Definition) WithAttributes(kv ...any) *Error { |