exceptions.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. from typing import Optional
  2. class FABException(Exception):
  3. """Base FAB Exception"""
  4. def __init__(self, *args, exception: Optional[Exception] = None) -> None:
  5. self.exception = exception
  6. super().__init__(*args)
  7. def __str__(self):
  8. return (
  9. f"{self.__class__.__name__}: {self.exception.__class__.__name__}"
  10. if self.exception
  11. else super().__str__()
  12. )
  13. class InvalidColumnFilterFABException(FABException):
  14. """Invalid column for filter"""
  15. ...
  16. class InvalidOperationFilterFABException(FABException):
  17. """Invalid operation for filter"""
  18. ...
  19. class InvalidOrderByColumnFABException(FABException):
  20. """Invalid order by column"""
  21. ...
  22. class InterfaceQueryWithoutSession(FABException):
  23. """You need to setup a session on the interface to perform queries"""
  24. ...
  25. class PasswordComplexityValidationError(FABException):
  26. """Raise this when implementing your own password complexity function"""
  27. ...
  28. class ApplyFilterException(FABException):
  29. """When executing an apply filter a SQLAlchemy exception happens"""
  30. ...
  31. class OAuthProviderUnknown(FABException):
  32. """
  33. When an OAuth provider is not supported/unknown
  34. """
  35. ...
  36. class InvalidLoginAttempt(FABException):
  37. """
  38. When the credentials entered could not be verified
  39. """
  40. ...