exceptions.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. """Custom Exceptions."""
  2. class ReflexError(Exception):
  3. """Base exception for all Reflex exceptions."""
  4. class ReflexRuntimeError(ReflexError, RuntimeError):
  5. """Custom RuntimeError for Reflex."""
  6. class UploadTypeError(ReflexError, TypeError):
  7. """Custom TypeError for upload related errors."""
  8. class EnvVarValueError(ReflexError, ValueError):
  9. """Custom ValueError raised when unable to convert env var to expected type."""
  10. class ComponentTypeError(ReflexError, TypeError):
  11. """Custom TypeError for component related errors."""
  12. class EventHandlerTypeError(ReflexError, TypeError):
  13. """Custom TypeError for event handler related errors."""
  14. class EventHandlerValueError(ReflexError, ValueError):
  15. """Custom ValueError for event handler related errors."""
  16. class StateValueError(ReflexError, ValueError):
  17. """Custom ValueError for state related errors."""
  18. class VarNameError(ReflexError, NameError):
  19. """Custom NameError for when a state var has been shadowed by a substate var."""
  20. class VarTypeError(ReflexError, TypeError):
  21. """Custom TypeError for var related errors."""
  22. class VarValueError(ReflexError, ValueError):
  23. """Custom ValueError for var related errors."""
  24. class VarAttributeError(ReflexError, AttributeError):
  25. """Custom AttributeError for var related errors."""
  26. class UploadValueError(ReflexError, ValueError):
  27. """Custom ValueError for upload related errors."""
  28. class RouteValueError(ReflexError, ValueError):
  29. """Custom ValueError for route related errors."""
  30. class VarOperationTypeError(ReflexError, TypeError):
  31. """Custom TypeError for when unsupported operations are performed on vars."""
  32. class VarDependencyError(ReflexError, ValueError):
  33. """Custom ValueError for when a var depends on a non-existent var."""
  34. class InvalidStylePropError(ReflexError, TypeError):
  35. """Custom Type Error when style props have invalid values."""
  36. class ImmutableStateError(ReflexError):
  37. """Raised when a background task attempts to modify state outside of context."""
  38. class LockExpiredError(ReflexError):
  39. """Raised when the state lock expires while an event is being processed."""
  40. class MatchTypeError(ReflexError, TypeError):
  41. """Raised when the return types of match cases are different."""