Move Fail2Ban exceptions into central app.exceptions module

This commit is contained in:
2026-04-15 10:22:48 +02:00
parent a79f5339bc
commit 328f3575e2
18 changed files with 305 additions and 365 deletions

View File

@@ -27,6 +27,24 @@ class ServerOperationError(Exception):
"""Raised when a server control command (e.g. refresh) fails."""
class Fail2BanConnectionError(Exception):
"""Raised when the fail2ban socket is unreachable or returns an error."""
def __init__(self, message: str, socket_path: str) -> None:
"""Initialize with a human-readable message and the socket path.
Args:
message: Description of the connection problem.
socket_path: The fail2ban socket path that was targeted.
"""
self.socket_path: str = socket_path
super().__init__(f"{message} (socket: {socket_path})")
class Fail2BanProtocolError(Exception):
"""Raised when the response from fail2ban cannot be parsed."""
class FilterInvalidRegexError(Exception):
"""Raised when a regex pattern fails to compile."""