26 lines
715 B
Python
26 lines
715 B
Python
"""Inventory domain exceptions."""
|
|
|
|
|
|
class InventoryError(Exception):
|
|
"""Base exception for inventory operations."""
|
|
|
|
|
|
class InventoryValidationError(InventoryError):
|
|
"""Raised when an inventory business rule is violated."""
|
|
|
|
|
|
class DuplicateAssetID(InventoryError):
|
|
"""Raised when an Asset ID is already assigned to another miner."""
|
|
|
|
def __init__(self, asset_id: str):
|
|
self.asset_id = asset_id
|
|
super().__init__(f"Asset ID already exists: {asset_id}")
|
|
|
|
|
|
class MinerNotFound(InventoryError):
|
|
"""Raised when an inventory miner cannot be found."""
|
|
|
|
def __init__(self, miner_id: object):
|
|
self.miner_id = miner_id
|
|
super().__init__(f"Miner not found: {miner_id}")
|