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.

34 lines
788B

  1. package cache
  2. import (
  3. "errors"
  4. "fmt"
  5. )
  6. // Cached errors.
  7. var (
  8. ErrCacheMiss = errors.New("cache miss")
  9. ErrCacheExpired = errors.New("cache expired")
  10. ErrSourceNotValid = errors.New("source is not valid")
  11. ErrKeyNotValid = errors.New("key is not valid")
  12. ErrTargetNil = errors.New("target is nil")
  13. ErrOperationNotAllwed = errors.New("operation not allowed")
  14. )
  15. var _ error = ErrorTarget{}
  16. // NewErrorTarget creates new target error.
  17. func NewErrorTarget(target interface{}) ErrorTarget {
  18. return ErrorTarget{target: target}
  19. }
  20. // ErrorTarget errs target is not a settable.
  21. type ErrorTarget struct {
  22. target interface{}
  23. }
  24. // ErrorTarget errors.
  25. func (e ErrorTarget) Error() string {
  26. return fmt.Sprintf("target is not a settable %T", e.target)
  27. }