diff --git a/aries_cloudagent/messaging/models/base_record.py b/aries_cloudagent/messaging/models/base_record.py index 622361af6c..80b22c1898 100644 --- a/aries_cloudagent/messaging/models/base_record.py +++ b/aries_cloudagent/messaging/models/base_record.py @@ -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: @@ -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