fcdbf5e509
All logic errors are wrapped in `logicerr.Logical` type and do not affect shard error counter. Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
21 lines
394 B
Go
21 lines
394 B
Go
package logicerr
|
|
|
|
// Logical is a wrapper for logical errors.
|
|
type Logical struct {
|
|
err error
|
|
}
|
|
|
|
// Error implements the error interface.
|
|
func (e Logical) Error() string {
|
|
return e.err.Error()
|
|
}
|
|
|
|
// Wrap wraps arbitrary error into a logical one.
|
|
func Wrap(err error) Logical {
|
|
return Logical{err: err}
|
|
}
|
|
|
|
// Unwrap returns underlying error.
|
|
func (e Logical) Unwrap() error {
|
|
return e.err
|
|
}
|