# app/exceptions/shop.py """ Shop management specific exceptions. """ from .base import ( ResourceNotFoundException, ConflictException ) class ProductAlreadyExistsException(ConflictException): """Raised when trying to add a product that already exists in shop.""" def __init__(self, shop_code: str, marketplace_product_id: str): super().__init__( message=f"MarketplaceProduct '{marketplace_product_id}' already exists in shop '{shop_code}'", error_code="PRODUCT_ALREADY_EXISTS", details={ "shop_code": shop_code, "marketplace_product_id": marketplace_product_id, }, ) class ProductNotFoundException(ResourceNotFoundException): """Raised when a shop product relationship is not found.""" def __init__(self, shop_code: str, marketplace_product_id: str): super().__init__( resource_type="ShopProduct", identifier=f"{shop_code}/{marketplace_product_id}", message=f"MarketplaceProduct '{marketplace_product_id}' not found in shop '{shop_code}'", error_code="PRODUCT_NOT_FOUND", )