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.

32 lines
648B

  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. ErrTargetNil = errors.New("target is nil")
  12. )
  13. var _ error = ErrorTarget{}
  14. // NewErrorTarget creates new error.
  15. func NewErrorTarget(target interface{}) ErrorTarget {
  16. return ErrorTarget{target: target}
  17. }
  18. // ErrorTarget errs target is not a settable.
  19. type ErrorTarget struct {
  20. target interface{}
  21. }
  22. // ErrorTarget errors.
  23. func (e ErrorTarget) Error() string {
  24. return fmt.Sprintf("target is not a settable %T", e.target)
  25. }