"""Domain exceptions for repair workflows.""" class RepairError(Exception): """Base exception for repair operations.""" class RepairMinerNotFound(RepairError): """Raised when the requested miner does not exist.""" def __init__(self, miner_id: object): self.miner_id = miner_id super().__init__(f"Miner not found: {miner_id}") class RepairNotFound(RepairError): """Raised when the requested repair does not exist.""" def __init__(self, repair_id: object): self.repair_id = repair_id super().__init__(f"Repair not found: {repair_id}") class RepairConflict(RepairError): """Base exception for a conflicting repair state.""" class ActiveRepairConflict(RepairConflict): """Raised when a miner already has an active repair.""" def __init__(self, miner_id: object): self.miner_id = miner_id super().__init__(f"Miner already has an active repair: {miner_id}") class IncompatibleMinerLifecycle(RepairConflict): """Raised when the miner lifecycle cannot enter repair.""" def __init__(self, miner_id: object, lifecycle_status: object): self.miner_id = miner_id self.lifecycle_status = lifecycle_status super().__init__( "Miner lifecycle is incompatible with beginning repair: " f"{lifecycle_status}" ) class InconsistentRepairState(RepairConflict): """Raised when lifecycle state and repair records disagree.""" def __init__(self, miner_id: object): self.miner_id = miner_id super().__init__( "Miner is marked in repair but has no active repair record" ) class RepairActorRequired(RepairError): """Raised when an operational workflow lacks an authenticated actor.""" def __init__(self): super().__init__("An authenticated actor is required to begin repair") class RepairPersistenceError(RepairError): """Raised when a required repair persistence operation fails."""