Pointer receiver methods for *Error (used for error accumulation) SetError sets the error if no error has occurred yet (first-error-wins)
(err error)
| 331 | |
| 332 | // SetError sets the error if no error has occurred yet (first-error-wins) |
| 333 | func (e *Error) SetError(err error) { |
| 334 | if e == nil || e.kind != ErrKindOK { |
| 335 | return |
| 336 | } |
| 337 | if foryErr, ok := err.(Error); ok { |
| 338 | *e = foryErr |
| 339 | } else if err != nil { |
| 340 | *e = Error{ |
| 341 | kind: ErrKindDeserializationFailed, |
| 342 | message: err.Error(), |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | // TakeError returns the error and clears it |
| 348 | func (e *Error) TakeError() error { |
no test coverage detected