29 lines
866 B
Python
29 lines
866 B
Python
|
|
"""
|
||
|
|
Domain-specific exceptions for issue management.
|
||
|
|
"""
|
||
|
|
|
||
|
|
|
||
|
|
class IssueDomainError(Exception):
|
||
|
|
"""Base exception for issue domain errors."""
|
||
|
|
|
||
|
|
def __init__(self, message: str, issue_number: int = None):
|
||
|
|
super().__init__(message)
|
||
|
|
self.issue_number = issue_number
|
||
|
|
|
||
|
|
|
||
|
|
class IssueValidationError(IssueDomainError):
|
||
|
|
"""Exception raised when issue validation fails."""
|
||
|
|
|
||
|
|
def __init__(self, message: str, field: str = None, value=None):
|
||
|
|
super().__init__(message)
|
||
|
|
self.field = field
|
||
|
|
self.value = value
|
||
|
|
|
||
|
|
|
||
|
|
class IssueStateError(IssueDomainError):
|
||
|
|
"""Exception raised when invalid state transitions are attempted."""
|
||
|
|
|
||
|
|
def __init__(self, message: str, current_state: str, attempted_state: str):
|
||
|
|
super().__init__(message)
|
||
|
|
self.current_state = current_state
|
||
|
|
self.attempted_state = attempted_state
|