Refactored setup.py again, confirmed that all filters are now working as expected. Work will resume on main branch now

This commit is contained in:
mwisnowski 2025-01-13 11:35:11 -08:00
parent c4d773d663
commit 000d804ba7
6 changed files with 584 additions and 262 deletions

View file

@ -82,4 +82,41 @@ class ColorFilterError(MTGSetupError):
self.color = color
self.details = details
error_info = f" - {details}" if details else ""
super().__init__(f"{message} for color '{color}'{error_info}")
super().__init__(f"{message} for color '{color}'{error_info}")
class CommanderValidationError(MTGSetupError):
"""Exception raised when commander validation fails.
This exception is raised when there are issues validating commander cards,
such as non-legendary creatures, color identity mismatches, or banned cards.
Args:
message: Explanation of the error
validation_type: Type of validation that failed (e.g., 'legendary_check', 'color_identity', 'banned_set')
details: Additional error details
Examples:
>>> raise CommanderValidationError(
... "Card must be legendary",
... "legendary_check",
... "Lightning Bolt is not a legendary creature"
... )
>>> raise CommanderValidationError(
... "Commander color identity mismatch",
... "color_identity",
... "Omnath, Locus of Creation cannot be used in Golgari deck"
... )
>>> raise CommanderValidationError(
... "Commander banned in format",
... "banned_set",
... "Golos, Tireless Pilgrim is banned in Commander"
... )
"""
def __init__(self, message: str, validation_type: str, details: str = None) -> None:
self.validation_type = validation_type
self.details = details
error_info = f" - {details}" if details else ""
super().__init__(f"{message} [{validation_type}]{error_info}")