CloseWithErrCapture closes closer and wraps any error with the provided message and assigns it to err.
(err *error, closer io.Closer, format string, a ...interface{})
| 20 | |
| 21 | // CloseWithErrCapture closes closer and wraps any error with the provided message and assigns it to err. |
| 22 | func CloseWithErrCapture(err *error, closer io.Closer, format string, a ...interface{}) { |
| 23 | merr := multierror.MultiError{} |
| 24 | |
| 25 | merr.Add(*err) |
| 26 | merr.Add(errors.Wrapf(closer.Close(), format, a...)) |
| 27 | |
| 28 | *err = merr.Err() |
| 29 | } |
| 30 | |
| 31 | // CloseWithLogOnErr closes an io.Closer and logs any relevant error from it wrapped with the provided format string and |
| 32 | // args. |