exceptions.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # SPDX-License-Identifier: MIT
  2. from __future__ import annotations
  3. class Argon2Error(Exception):
  4. """
  5. Superclass of all argon2 exceptions.
  6. Never thrown directly.
  7. """
  8. class VerificationError(Argon2Error):
  9. """
  10. Verification failed.
  11. You can find the original error message from Argon2 in ``args[0]``.
  12. """
  13. class VerifyMismatchError(VerificationError):
  14. """
  15. The secret does not match the hash.
  16. Subclass of :exc:`argon2.exceptions.VerificationError`.
  17. .. versionadded:: 16.1.0
  18. """
  19. class HashingError(Argon2Error):
  20. """
  21. Raised if hashing failed.
  22. You can find the original error message from Argon2 in ``args[0]``.
  23. """
  24. class InvalidHashError(ValueError):
  25. """
  26. Raised if the hash is invalid before passing it to Argon2.
  27. .. versionadded:: 23.1.0
  28. As a replacement for :exc:`argon2.exceptions.InvalidHash`.
  29. """
  30. class UnsupportedParametersError(ValueError):
  31. """
  32. Raised if the current platform does not support the parameters.
  33. For example, in WebAssembly parallelism must be set to 1.
  34. .. versionadded:: 25.1.0
  35. """
  36. InvalidHash = InvalidHashError
  37. """
  38. Deprecated alias for :class:`InvalidHashError`.
  39. .. versionadded:: 18.2.0
  40. .. deprecated:: 23.1.0
  41. Use :exc:`argon2.exceptions.InvalidHashError` instead.
  42. """