diff --git a/common/image_io.py b/common/image_io.py index 48a249f..fa7e554 100644 --- a/common/image_io.py +++ b/common/image_io.py @@ -102,7 +102,12 @@ def fetch_url_bytes(url: str, timeout: float = 10.0, max_bytes: int = DEFAULT_MA content_type = (r.headers.get("content-type") or "").lower() if content_type and not content_type.startswith("image/"): - raise ImageLoadError(f"URL does not point to an image content type: {content_type}") + raise _error( + f"URL does not point to an image content type: {content_type}", + category="invalid_content_type", + stage="fetch", + metadata={"content_type": content_type, "remote_status": r.status_code}, + ) buf = io.BytesIO() total = 0