frostfs-node/pkg/local_object_storage/internal/metaerr/error.go

34 lines
642 B
Go
Raw Normal View History

package metaerr
import "errors"
// Error is a wrapper for SSD-related errors.
// In our model it unites metabase, pilorama and write-cache errors.
type Error struct {
err error
}
// New returns simple error with a provided error message.
func New(msg string) Error {
return Error{err: errors.New(msg)}
}
// Error implements the error interface.
func (e Error) Error() string {
return e.err.Error()
}
// Wrap wraps arbitrary error.
// Returns nil if err == nil.
func Wrap(err error) error {
if err != nil {
return Error{err: err}
}
return nil
}
// Unwrap returns underlying error.
func (e Error) Unwrap() error {
return e.err
}