Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

exceptions.py 1.8KB

1 year ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # SPDX-License-Identifier: MIT
  2. class FrozenError(AttributeError):
  3. """
  4. A frozen/immutable instance or attribute have been attempted to be
  5. modified.
  6. It mirrors the behavior of ``namedtuples`` by using the same error message
  7. and subclassing `AttributeError`.
  8. .. versionadded:: 20.1.0
  9. """
  10. msg = "can't set attribute"
  11. args = [msg]
  12. class FrozenInstanceError(FrozenError):
  13. """
  14. A frozen instance has been attempted to be modified.
  15. .. versionadded:: 16.1.0
  16. """
  17. class FrozenAttributeError(FrozenError):
  18. """
  19. A frozen attribute has been attempted to be modified.
  20. .. versionadded:: 20.1.0
  21. """
  22. class AttrsAttributeNotFoundError(ValueError):
  23. """
  24. An *attrs* function couldn't find an attribute that the user asked for.
  25. .. versionadded:: 16.2.0
  26. """
  27. class NotAnAttrsClassError(ValueError):
  28. """
  29. A non-*attrs* class has been passed into an *attrs* function.
  30. .. versionadded:: 16.2.0
  31. """
  32. class DefaultAlreadySetError(RuntimeError):
  33. """
  34. A default has been set when defining the field and is attempted to be reset
  35. using the decorator.
  36. .. versionadded:: 17.1.0
  37. """
  38. class UnannotatedAttributeError(RuntimeError):
  39. """
  40. A class with ``auto_attribs=True`` has a field without a type annotation.
  41. .. versionadded:: 17.3.0
  42. """
  43. class PythonTooOldError(RuntimeError):
  44. """
  45. It was attempted to use an *attrs* feature that requires a newer Python
  46. version.
  47. .. versionadded:: 18.2.0
  48. """
  49. class NotCallableError(TypeError):
  50. """
  51. A field requiring a callable has been set with a value that is not
  52. callable.
  53. .. versionadded:: 19.2.0
  54. """
  55. def __init__(self, msg, value):
  56. super(TypeError, self).__init__(msg, value)
  57. self.msg = msg
  58. self.value = value
  59. def __str__(self):
  60. return str(self.msg)