err.py 694 B

12345678910111213141516171819202122232425262728293031
  1. from typing import Iterable
  2. class RequestTokenErr(Exception):
  3. """
  4. Represents an exception during token request.
  5. """
  6. def __init__(self, *args):
  7. super().__init__(*args)
  8. class InvalidTokenSchemaErr(Exception):
  9. """
  10. Represents an exception related to invalid token schema.
  11. """
  12. def __init__(self, missing_fields: Iterable[str] = []):
  13. super().__init__(
  14. "Unexpected token schema. Following fields are missing: "
  15. + ", ".join(missing_fields)
  16. )
  17. class TokenRenewalErr(Exception):
  18. """
  19. Represents an exception during token renewal process.
  20. """
  21. def __init__(self, *args):
  22. super().__init__(*args)