Aggregate aggregates the error and returns nil if there is no error; otherwise returns the error itself
()
| 434 | // Aggregate aggregates the error and returns nil if there is no error; |
| 435 | // otherwise returns the error itself |
| 436 | func (e *AggregateError) Aggregate() error { |
| 437 | if len(e.errs) == 0 { |
| 438 | return nil |
| 439 | } |
| 440 | |
| 441 | msg := "One or more operation failed" |
| 442 | if len(e.errs) == 1 { |
| 443 | for _, err := range e.errs { |
| 444 | msg = err.Error() |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | return NewError(CodeBatchOperationNotFullyCompleted, msg, e) |
| 449 | } |
| 450 | |
| 451 | func (e *AggregateError) FormatFirstN(n int) string { |
| 452 | if len(e.errs) == 0 { |
no test coverage detected