Error implements the built-in error interface.
()
| 454 | |
| 455 | // Error implements the built-in error interface. |
| 456 | func (err *ErrClose) Error() string { |
| 457 | if len(err.Errs) == 1 { |
| 458 | return err.Errs[0].Error() |
| 459 | } |
| 460 | |
| 461 | var buf bytes.Buffer |
| 462 | |
| 463 | fmt.Fprintf(&buf, "The following kites failed to close:\n\n") |
| 464 | |
| 465 | for i, e := range err.Errs { |
| 466 | if e == nil { |
| 467 | continue |
| 468 | } |
| 469 | |
| 470 | fmt.Fprintf(&buf, "\t[%d] %s\n", i, e) |
| 471 | } |
| 472 | |
| 473 | return buf.String() |
| 474 | } |
| 475 | |
| 476 | // Closer returns a io.Closer that can be used to close all the kites |
| 477 | // given by the generic argument. |