Skip to content

Commit

Permalink
add case for non decodable name
Browse files Browse the repository at this point in the history
  • Loading branch information
starknetdev committed Sep 9, 2024
1 parent 76b015a commit eff1531
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions indexer/graphql/src/indexer/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,14 @@ def parse_string(value):


def serialize_string(value):
# Assuming the input is a hexadecimal string
# Convert it back to bytes and then to a UTF-8 string
return bytes.fromhex(str(value)).decode("utf-8")
if value is None:
return None
try:
# Try to decode as UTF-8
return bytes.fromhex(str(value)).decode('utf-8')
except UnicodeDecodeError:
# If UTF-8 decoding fails, return the original hexadecimal string
return str(value)


def parse_class(value):
Expand Down

0 comments on commit eff1531

Please sign in to comment.