Skip to content

Commit

Permalink
🎨 handle possible json.loads errors
Browse files Browse the repository at this point in the history
Signed-off-by: ff137 <[email protected]>
  • Loading branch information
ff137 committed Jul 4, 2024
1 parent 5dacc49 commit d3a082a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aries_cloudagent/messaging/models/base_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ async def query(

result = []
for record in rows:
vals = json.loads(record.value)
try:
vals = json.loads(record.value)
if not post_filter: # pagination would already be applied if requested
result.append(cls.from_storage(record.id, vals))
else:
Expand All @@ -364,7 +364,7 @@ async def query(
result.append(cls.from_storage(record.id, vals))

num_results_post_filter += 1
except BaseModelError as err:
except (BaseModelError, json.JSONDecodeError, TypeError) as err:
raise BaseModelError(f"{err}, for record id {record.id}")
return result

Expand Down

0 comments on commit d3a082a

Please sign in to comment.