Raise InvalidToken-compatible errors

This commit is contained in:
thePR0M3TH3AN committed 2025-08-23 12:21:56 -04:00
1 parent bebbca8169
commit d030cf9692
2 files changed
+31 -14

No files matched your search

+7 -2
View File
@@ -9,6 +9,7 @@ exception, displaying a friendly message and exiting with code ``1``.
"""
from click import ClickException
from cryptography.fernet import InvalidToken
class SeedPassError(ClickException):
@@ -18,8 +19,12 @@ class SeedPassError(ClickException):
super().__init__(message)
class DecryptionError(SeedPassError):
"""Raised when encrypted data cannot be decrypted."""
class DecryptionError(InvalidToken, SeedPassError):
"""Raised when encrypted data cannot be decrypted.
Subclasses :class:`cryptography.fernet.InvalidToken` so callers expecting
the cryptography exception continue to work.
"""
__all__ = ["SeedPassError", "DecryptionError"]