You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
794 B

package cache
import (
"errors"
"fmt"
)
// Cached errors.
var (
ErrCacheMiss = errors.New("cache miss")
ErrCacheExpired = errors.New("cache expired")
ErrSourceNotValid = errors.New("source is not valid")
ErrKeyNotValid = errors.New("key is not valid")
ErrTargetNil = errors.New("target is nil")
ErrOperationNotAllwed = errors.New("operation not allowed")
)
var _ error = NewErrorTarget(nil)
// NewErrorTarget creates new target error.
func NewErrorTarget(target interface{}) ErrorTarget {
return ErrorTarget{target: target}
}
// ErrorTarget errs target is not a settable.
type ErrorTarget struct {
target interface{}
}
// ErrorTarget errors.
func (e ErrorTarget) Error() string {
return fmt.Sprintf("target is not a settable %T", e.target)
}