From 693aac4731a0a2d964b86a3013b540308313ab5b Mon Sep 17 00:00:00 2001 From: harisang Date: Sun, 17 Sep 2023 00:14:07 +0300 Subject: [PATCH 1/2] catch exception when adding missing tokens --- src/missing_tokens.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/missing_tokens.py b/src/missing_tokens.py index c6bfbdc..815d911 100644 --- a/src/missing_tokens.py +++ b/src/missing_tokens.py @@ -102,7 +102,13 @@ def fetch_missing_tokens(dune: DuneClient, network: Network) -> list[Address]: print(f"Fetching missing tokens for {network} from {query.url()}") v2_missing = dune.refresh(query, ping_frequency=10) - return [Address(row["token"]) for row in v2_missing.get_rows()] + result = [] + for row in v2_missing.get_rows(): + try: + result.append(Address(row["token"])) + except: + print("Cannot add token") + return result def replace_line(old_line: str, new_line: str, file_loc: str): From 68f8d36617a996264c2612787ac66dd920917f09 Mon Sep 17 00:00:00 2001 From: harisang Date: Sun, 17 Sep 2023 00:20:58 +0300 Subject: [PATCH 2/2] add exception type --- src/missing_tokens.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/missing_tokens.py b/src/missing_tokens.py index 815d911..9e88559 100644 --- a/src/missing_tokens.py +++ b/src/missing_tokens.py @@ -106,7 +106,7 @@ def fetch_missing_tokens(dune: DuneClient, network: Network) -> list[Address]: for row in v2_missing.get_rows(): try: result.append(Address(row["token"])) - except: + except ValueError: print("Cannot add token") return result