from fansifter_common.exceptions import FansifterError, ObjectNotFoundError class AssetNotFoundError(ObjectNotFoundError): code = "asset_not_found" message = "Asset not found" status_code = 404 class InvalidAssetIdError(FansifterError): code = "invalid_asset_id" message = "Invalid asset ID" status_code = 400 class InvalidContentTypeError(FansifterError): code = "invalid_content_type" message = "Invalid content type" status_code = 400 additional_properties = ( ("content_type", str), ("allowed_content_types", list[str]), ) def __init__( self, content_type: str, allowed_content_types: list[str], ) -> None: super().__init__() self.content_type = content_type self.allowed_content_types = allowed_content_types class InvalidFileSizeError(FansifterError): code = "invalid_file_size" message = "Invalid file size" status_code = 400 additional_properties = ( ("size", int), ("min_size", int), ("max_size", int), ) def __init__(self, size: int, min_size: int, max_size: int) -> None: super().__init__() self.size = size self.min_size = min_size self.max_size = max_size class ImageValidationError(FansifterError): code = "invalid_image" message = "Invalid image" status_code = 400 class InvalidImageSizeError(ImageValidationError): code = "invalid_image_size" message = "Invalid image size" additional_properties = ( ("width", int), ("height", int), ("min_width", int), ("min_height", int), ) def __init__( self, width: int, height: int, min_width: int, min_height: int ) -> None: super().__init__() self.width = width self.height = height self.min_width = min_width self.min_height = min_height class ImageProcessError(FansifterError): code = "image_process_error" message = "Image could not be processed" status_code = 400