exceptions.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. """
  2. Exceptions used in hpack.
  3. """
  4. from __future__ import annotations
  5. class HPACKError(Exception):
  6. """
  7. The base class for all ``hpack`` exceptions.
  8. """
  9. class HPACKDecodingError(HPACKError):
  10. """
  11. An error has been encountered while performing HPACK decoding.
  12. """
  13. class InvalidTableIndexError(HPACKDecodingError):
  14. """
  15. An invalid table index was received.
  16. .. versionadded:: 4.1.0
  17. """
  18. class InvalidTableIndex(InvalidTableIndexError): # noqa: N818
  19. """
  20. An invalid table index was received.
  21. .. deprecated:: 4.1.0
  22. Renamed to :class:`InvalidTableIndexError`, use it instead.
  23. """
  24. class OversizedHeaderListError(HPACKDecodingError):
  25. """
  26. A header list that was larger than we allow has been received. This may be
  27. a DoS attack.
  28. .. versionadded:: 2.3.0
  29. """
  30. class InvalidTableSizeError(HPACKDecodingError):
  31. """
  32. An attempt was made to change the decoder table size to a value larger than
  33. allowed, or the list was shrunk and the remote peer didn't shrink their
  34. table size.
  35. .. versionadded:: 3.0.0
  36. """