Files
030-password-manager/src/password_manager/domain/errors.py
T
Tirsvad 239f8163fe feat: domain, use cases and JSON repository with file error handling
Task: MIL-002#1
Task: MIL-002#2
Task: MIL-002#3
Task: MIL-002#4
2026-10-14 21:26:08 +08:00

33 lines
891 B
Python

"""@brief Errors raised by the business rules of the password manager.
@file errors.py
"""
class PasswordManagerError(Exception):
"""@brief Base class of every error the password manager raises on purpose."""
class EmptyFieldError(PasswordManagerError):
"""@brief A required field was left empty."""
class DataFileNotFoundError(PasswordManagerError):
"""@brief The data file does not exist, so nothing can be looked up."""
class InvalidDataFileError(PasswordManagerError):
"""@brief The data file exists but does not hold the expected structure."""
class EntryNotFoundError(PasswordManagerError):
"""@brief No entry is stored for a website."""
def __init__(self, website: str) -> None:
"""@brief Create the error.
@param website The website that was looked up.
"""
super().__init__(website)
self.website = website