Skip to content

Commit

Permalink
Update logging and exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
lealobanov committed Nov 1, 2024
1 parent f9f4dc6 commit cdfb195
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions flow_py_sdk/client/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ def __init__(
logging.error(
f"JSON decode error for event {event_index} with payload: {payload[:100]}... Error: {str(e)}"
)
self.value = None
raise
except Exception as e:
logging.error(
f"Unexpected error deserializing payload for event {event_index} with payload: {payload[:100]}... Error: {str(e)}"
)
self.value = None
raise

@classmethod
def from_proto(cls, proto: entities.Event) -> "Event":
Expand All @@ -179,7 +179,7 @@ def from_proto(cls, proto: entities.Event) -> "Event":
)
except Exception as e:
logging.error(f"Failed to deserialize event {proto.event_index}: {str(e)}")
return None # Returning None if deserialization fails
raise


class Transaction(object):
Expand Down Expand Up @@ -312,11 +312,11 @@ def from_proto(
for i, event_proto in enumerate(proto.events):
try:
event = Event.from_proto(event_proto)
if event is not None:
events.append(event)
events.append(event)
except Exception as e:
logging.error(f"Failed to deserialize event {i}: {e}")
continue
raise


return TransactionResultResponse(
id_=id,
Expand Down

0 comments on commit cdfb195

Please sign in to comment.