exceptions.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. class UnpackException(Exception):
  2. """Deprecated. Use Exception instead to catch all exception during unpacking."""
  3. class BufferFull(UnpackException):
  4. pass
  5. class OutOfData(UnpackException):
  6. pass
  7. class UnpackValueError(UnpackException, ValueError):
  8. """Deprecated. Use ValueError instead."""
  9. class ExtraData(UnpackValueError):
  10. def __init__(self, unpacked, extra):
  11. self.unpacked = unpacked
  12. self.extra = extra
  13. def __str__(self):
  14. return "unpack(b) received extra data."
  15. class PackException(Exception):
  16. """Deprecated. Use Exception instead to catch all exception during packing."""
  17. class PackValueError(PackException, ValueError):
  18. """PackValueError is raised when type of input data is supported but it's value is unsupported.
  19. Deprecated. Use ValueError instead.
  20. """
  21. class PackOverflowError(PackValueError, OverflowError):
  22. """PackOverflowError is raised when integer value is out of range of msgpack support [-2**31, 2**32).
  23. Deprecated. Use ValueError instead.
  24. """