Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
update patch
  • Loading branch information
l0lawrence committed Jun 11, 2024
commit 95d70ff34807f0a4d0621f4d856cd2c4d19dbf73
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ def send(
# Try to send via namespace
self._publish(self._namespace, _serialize_events(events), **kwargs)
except Exception as exception: # pylint: disable=broad-except
if exception.response.status_code == 400:
raise HttpResponseError("Are the provided event(s) in CloudEvent format?") from exception
self._http_response_error_handler(exception)
raise exception
else:
Expand Down Expand Up @@ -307,8 +309,8 @@ def _serialize_events(events):
# Try to serialize CNCF Cloud Events
return [_from_cncf_events(e) for e in events]
else:
# Does not conform to format
raise TypeError("Invalid event data. Please check the data is of Cloud Event type/format and try again.")
# Does not conform to format, try to send
return events


def _serialize_cloud_event(cloud_event):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ async def send(
# Try to send via namespace
await self._publish(self._namespace, _serialize_events(events), **kwargs)
except Exception as exception: # pylint: disable=broad-except
if exception.response.status_code == 400:
raise HttpResponseError("Are the provided event(s) in CloudEvent format?") from exception
self._http_response_error_handler(exception)
raise exception
else:
Expand Down