diff --git a/offchain/metadata/parsers/catchall/default_catchall.py b/offchain/metadata/parsers/catchall/default_catchall.py index 97fbdba..43f9fa4 100644 --- a/offchain/metadata/parsers/catchall/default_catchall.py +++ b/offchain/metadata/parsers/catchall/default_catchall.py @@ -1,6 +1,7 @@ import asyncio from typing import Optional +from offchain.logger.logging import logger from offchain.metadata.models.metadata import Attribute, MediaDetails, Metadata from offchain.metadata.models.token import Token from offchain.metadata.parsers.catchall.catchall_parser import CatchallParser @@ -100,8 +101,10 @@ async def gen_image_details(self, raw_data: dict) -> Optional[MediaDetails]: # ) details.size = size details.mime_type = content_type - except Exception: - pass + except Exception as e: + logger.error( + f"{self.__class__.__name__} fail to fetch image {image_uri=}. {str(e)}" + ) if isinstance(raw_data.get("image_details"), dict): details.size = raw_data["image_details"].get("size") @@ -142,8 +145,11 @@ async def gen_content_details(self, raw_data: dict) -> Optional[MediaDetails]: ) details.size = size details.mime_type = content_type - except Exception: - pass + except Exception as e: + logger.error( + f"{self.__class__.__name__} fail to fetch mime_type_and_size " + f"{content_uri=}. {str(e)}" + ) if isinstance(raw_data.get("animation_details"), dict): details.size = raw_data["animation_details"].get("size") details.sha256 = raw_data["animation_details"].get("sha256") diff --git a/offchain/metadata/parsers/collection/artblocks.py b/offchain/metadata/parsers/collection/artblocks.py index 8f9606d..a8068f5 100644 --- a/offchain/metadata/parsers/collection/artblocks.py +++ b/offchain/metadata/parsers/collection/artblocks.py @@ -2,6 +2,7 @@ from typing import Optional from offchain.constants.addresses import CollectionAddress +from offchain.logger.logging import logger from offchain.metadata.models.metadata import ( Attribute, MediaDetails, @@ -260,8 +261,10 @@ async def gen_image(self, raw_data: dict) -> Optional[MediaDetails]: # type: ig image.mime_type = content_type image.size = size return image - except Exception: - pass + except Exception as e: + logger.error( + f"{self.__class__.__name__} fail to fetch image {image_uri=}. {str(e)}" + ) async def _gen_parse_metadata_impl( self, token: Token, raw_data: dict, *args, **kwargs diff --git a/offchain/metadata/parsers/collection/autoglyphs.py b/offchain/metadata/parsers/collection/autoglyphs.py index 0e60bb9..0f33d11 100644 --- a/offchain/metadata/parsers/collection/autoglyphs.py +++ b/offchain/metadata/parsers/collection/autoglyphs.py @@ -2,6 +2,7 @@ from typing import Optional from offchain.constants.addresses import CollectionAddress +from offchain.logger.logging import logger from offchain.metadata.constants.autoglyphs import get_symbol_by_index from offchain.metadata.models.metadata import ( Attribute, @@ -107,8 +108,10 @@ async def gen_image_details(self, raw_data: dict) -> Optional[MediaDetails]: # content_type, size = await self.fetcher.gen_fetch_mime_type_and_size(image_uri) # type: ignore[arg-type] # noqa: E501 details.mime_type = content_type details.size = size - except Exception: - pass + except Exception as e: + logger.error( + f"{self.__class__.__name__} fail to fetch image details {image_uri=}. {str(e)}" + ) return details def get_content_details(self, index: int) -> Optional[MediaDetails]: diff --git a/offchain/metadata/parsers/collection/ens.py b/offchain/metadata/parsers/collection/ens.py index 74ab933..9110898 100644 --- a/offchain/metadata/parsers/collection/ens.py +++ b/offchain/metadata/parsers/collection/ens.py @@ -131,8 +131,10 @@ async def gen_image(self, raw_data: dict) -> Optional[MediaDetails]: # type: ig image.mime_type = content_type image.size = size return image - except Exception: - pass + except Exception as e: + logger.error( + f"{self.__class__.__name__} fail to fetch image {image_uri=}. {str(e)}" + ) async def gen_background_image(self, raw_data: dict) -> Optional[MediaDetails]: # type: ignore[return, type-arg] # noqa: E501 bg_image_uri = raw_data.get("background_image") @@ -147,8 +149,10 @@ async def gen_background_image(self, raw_data: dict) -> Optional[MediaDetails]: image.mime_type = content_type image.size = size return image - except Exception: - pass + except Exception as e: + logger.error( + f"{self.__class__.__name__} fail to fetch background image {bg_image_uri=}. {str(e)}" + ) async def _gen_parse_metadata_impl(self, token: Token, raw_data: dict, *args, **kwargs) -> Optional[Metadata]: # type: ignore[no-untyped-def, type-arg] # noqa: E501 ens_chain_name = self.make_ens_chain_name(token.chain_identifier) diff --git a/offchain/metadata/parsers/collection/hashmasks.py b/offchain/metadata/parsers/collection/hashmasks.py index 07646ab..7a38f69 100644 --- a/offchain/metadata/parsers/collection/hashmasks.py +++ b/offchain/metadata/parsers/collection/hashmasks.py @@ -2,6 +2,7 @@ from typing import Optional from offchain.constants.addresses import CollectionAddress +from offchain.logger.logging import logger from offchain.metadata.models.metadata import ( Attribute, MediaDetails, @@ -97,8 +98,10 @@ async def gen_image(self, raw_data: dict) -> Optional[MediaDetails]: # type: ig image.mime_type = content_type image.size = size return image - except Exception: - pass + except Exception as e: + logger.error( + f"{self.__class__.__name__} fail to fetch image {image_uri=}. {str(e)}" + ) def parse_metadata(self, token: Token, raw_data: dict, *args, **kwargs) -> Optional[Metadata]: # type: ignore[no-untyped-def, type-arg] # noqa: E501 token.uri = f"https://hashmap.azurewebsites.net/getMask/{token.token_id}" diff --git a/offchain/metadata/parsers/collection/makersplace.py b/offchain/metadata/parsers/collection/makersplace.py index 8872d69..d4d18ae 100644 --- a/offchain/metadata/parsers/collection/makersplace.py +++ b/offchain/metadata/parsers/collection/makersplace.py @@ -1,6 +1,7 @@ from typing import Optional from offchain.constants.addresses import CollectionAddress +from offchain.logger.logging import logger from offchain.metadata.adapters.ipfs import build_request_url from offchain.metadata.models.metadata import MediaDetails, Metadata from offchain.metadata.models.token import Token @@ -86,8 +87,10 @@ async def gen_content_details(self, raw_data: dict) -> Optional[MediaDetails]: content_type, size = await self.fetcher.gen_fetch_mime_type_and_size(url) details.mime_type = content_type details.size = size - except Exception: - pass + except Exception as e: + logger.error( + f"{self.__class__.__name__} fail to fetch content detail {url=}. {str(e)}" + ) return details diff --git a/offchain/metadata/parsers/collection/superrare.py b/offchain/metadata/parsers/collection/superrare.py index c9a81fe..17857b5 100644 --- a/offchain/metadata/parsers/collection/superrare.py +++ b/offchain/metadata/parsers/collection/superrare.py @@ -2,6 +2,7 @@ from typing import Optional from offchain.constants.addresses import CollectionAddress +from offchain.logger.logging import logger from offchain.metadata.models.metadata import ( MediaDetails, Metadata, @@ -41,8 +42,10 @@ async def gen_image_details(self, raw_data: dict) -> Optional[MediaDetails]: # ) details.mime_type = content_type details.size = size - except Exception: - pass + except Exception as e: + logger.error( + f"{self.__class__.__name__} fail to fetch image {image_uri=}. {str(e)}" + ) return details def get_content_details(self, raw_data: dict) -> Optional[MediaDetails]: # type: ignore[type-arg] # noqa: E501 @@ -88,8 +91,11 @@ async def gen_content_details(self, raw_data: dict) -> Optional[MediaDetails]: ) details.mime_type = content_type details.size = size - except Exception: - pass + except Exception as e: + logger.error( + f"{self.__class__.__name__} fail to fetch content type and size " + f"{content_uri=}. {str(e)}" + ) return details diff --git a/offchain/metadata/parsers/collection/zora.py b/offchain/metadata/parsers/collection/zora.py index b4d08da..5d69672 100644 --- a/offchain/metadata/parsers/collection/zora.py +++ b/offchain/metadata/parsers/collection/zora.py @@ -2,6 +2,7 @@ from typing import Optional from offchain.constants.addresses import CollectionAddress +from offchain.logger.logging import logger from offchain.metadata.models.metadata import ( MediaDetails, Metadata, @@ -99,8 +100,8 @@ async def gen_content_details(self, uri: str) -> Optional[MediaDetails]: try: content_type, size = await self.fetcher.gen_fetch_mime_type_and_size(uri) return MediaDetails(uri=uri, size=size, sha256=None, mime_type=content_type) - except Exception: - pass + except Exception as e: + logger.error(f"{self.__class__.__name__} fail to content {uri=}. {str(e)}") return None