exceptions.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from __future__ import absolute_import, division, print_function
  2. class FrozenInstanceError(AttributeError):
  3. """
  4. A frozen/immutable instance has been attempted to be modified.
  5. It mirrors the behavior of ``namedtuples`` by using the same error message
  6. and subclassing :exc:`AttributeError`.
  7. .. versionadded:: 16.1.0
  8. """
  9. msg = "can't set attribute"
  10. args = [msg]
  11. class AttrsAttributeNotFoundError(ValueError):
  12. """
  13. An ``attrs`` function couldn't find an attribute that the user asked for.
  14. .. versionadded:: 16.2.0
  15. """
  16. class NotAnAttrsClassError(ValueError):
  17. """
  18. A non-``attrs`` class has been passed into an ``attrs`` function.
  19. .. versionadded:: 16.2.0
  20. """
  21. class DefaultAlreadySetError(RuntimeError):
  22. """
  23. A default has been set using ``attr.ib()`` and is attempted to be reset
  24. using the decorator.
  25. .. versionadded:: 17.1.0
  26. """
  27. class UnannotatedAttributeError(RuntimeError):
  28. """
  29. A class with ``auto_attribs=True`` has an ``attr.ib()`` without a type
  30. annotation.
  31. .. versionadded:: 17.3.0
  32. """