errors.go 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. package tg
  2. import (
  3. "errors"
  4. "fmt"
  5. )
  6. type WrongUpdateType struct {
  7. Type string
  8. }
  9. var (
  10. ScreenNotExistErr = errors.New("screen does not exist")
  11. SessionNotExistErr = errors.New("session does not exist")
  12. KeyboardNotExistErr = errors.New("keyboard does not exist")
  13. NotAvailableErr = errors.New("the context is not available")
  14. EmptyKeyboardTextErr = errors.New("got empty text for a keyboard")
  15. ActionNotDefinedErr = errors.New("action was not defined")
  16. MapCollisionErr = errors.New("map collision occured")
  17. ContextNotExistErr = errors.New("the context does not exist")
  18. StatusCodeErr = errors.New("not success response status code")
  19. NotSendErr = errors.New("could not send message")
  20. NoWidgetForScreenErr = errors.New("no widget defined for the screen")
  21. EmptyCompoErr = errors.New("empty component")
  22. EmptyWidgetErr = errors.New("empty widget")
  23. )
  24. func (wut WrongUpdateType) Error() string {
  25. if wut.Type == "" {
  26. return "wrong update type"
  27. }
  28. return fmt.Sprintf("wrong update type '%s'", wut.Type)
  29. }