github.com/MontFerret/ferret@v0.18.0/pkg/drivers/common/errors.go (about)

     1  package common
     2  
     3  import (
     4  	"io"
     5  
     6  	"github.com/rs/zerolog"
     7  
     8  	"github.com/MontFerret/ferret/pkg/runtime/core"
     9  )
    10  
    11  var (
    12  	ErrReadOnly    = core.Error(core.ErrInvalidOperation, "read only")
    13  	ErrInvalidPath = core.Error(core.ErrInvalidOperation, "invalid path")
    14  )
    15  
    16  func CloseAll(logger zerolog.Logger, closers []io.Closer, msg string) {
    17  	for _, closer := range closers {
    18  		if err := closer.Close(); err != nil {
    19  			logger.Error().Err(err).Msg(msg)
    20  		}
    21  	}
    22  }