exceptions.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. """Custom Exceptions for HACS."""
  2. class HacsException(Exception):
  3. """Super basic."""
  4. class HacsRepositoryArchivedException(HacsException):
  5. """For repositories that are archived."""
  6. class HacsNotModifiedException(HacsException):
  7. """For responses that are not modified."""
  8. class HacsExpectedException(HacsException):
  9. """For stuff that are expected."""
  10. class HacsRepositoryExistException(HacsException):
  11. """For repositories that are already exist."""
  12. class HacsExecutionStillInProgress(HacsException):
  13. """Exception to raise if execution is still in progress."""
  14. class AddonRepositoryException(HacsException):
  15. """Exception to raise when user tries to add add-on repository."""
  16. exception_message = (
  17. "The repository does not seem to be a integration, "
  18. "but an add-on repository. HACS does not manage add-ons."
  19. )
  20. def __init__(self) -> None:
  21. super().__init__(self.exception_message)
  22. class HomeAssistantCoreRepositoryException(HacsException):
  23. """Exception to raise when user tries to add the home-assistant/core repository."""
  24. exception_message = (
  25. "You can not add homeassistant/core, to use core integrations "
  26. "check the Home Assistant documentation for how to add them."
  27. )
  28. def __init__(self) -> None:
  29. super().__init__(self.exception_message)