errors.py 662 B

123456789101112131415161718192021222324252627282930
  1. """
  2. errors and exceptions
  3. """
  4. from __future__ import annotations
  5. class ConfigurationError(Exception):
  6. """
  7. Error raised when a configuration problem is encountered
  8. """
  9. class ConcurrentUpdateError(Exception):
  10. """
  11. Error raised when an update to limit fails due to concurrent
  12. updates
  13. """
  14. def __init__(self, key: str, attempts: int) -> None:
  15. super().__init__(f"Unable to update {key} after {attempts} retries")
  16. class StorageError(Exception):
  17. """
  18. Error raised when an error is encountered in a storage
  19. """
  20. def __init__(self, storage_error: Exception) -> None:
  21. self.storage_error = storage_error