2019-02-19 18:10:18 -05:00
|
|
|
package common
|
|
|
|
|
2019-12-24 18:47:21 -05:00
|
|
|
import (
|
2020-11-23 20:12:04 -05:00
|
|
|
"io"
|
|
|
|
|
2019-12-24 18:47:21 -05:00
|
|
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
|
|
|
"github.com/rs/zerolog"
|
|
|
|
)
|
2019-02-19 18:10:18 -05:00
|
|
|
|
|
|
|
var (
|
|
|
|
ErrReadOnly = core.Error(core.ErrInvalidOperation, "read only")
|
|
|
|
ErrInvalidPath = core.Error(core.ErrInvalidOperation, "invalid path")
|
|
|
|
)
|
2019-12-24 18:47:21 -05:00
|
|
|
|
2021-09-02 11:09:48 -04:00
|
|
|
func CloseAll(logger zerolog.Logger, closers []io.Closer, msg string) {
|
2019-12-24 18:47:21 -05:00
|
|
|
for _, closer := range closers {
|
|
|
|
if err := closer.Close(); err != nil {
|
|
|
|
logger.Error().Err(err).Msg(msg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|