WithAttributes returns a new error from the definition, and sets the given attributes.
(kv ...any)
| 112 | |
| 113 | // WithAttributes returns a new error from the definition, and sets the given attributes. |
| 114 | func (d *Definition) WithAttributes(kv ...any) *Error { |
| 115 | if d == nil { |
| 116 | return nil |
| 117 | } |
| 118 | e := build(d, 0) // Don't refactor this to build(...).WithAttributes(...) |
| 119 | e.mergeAttributes(kv...) |
| 120 | return e |
| 121 | } |
| 122 | |
| 123 | // Attributes of the error. |
| 124 | func (e *Error) Attributes() map[string]any { |
nothing calls this directly
no test coverage detected