Skip to content
Merged
Changes from all commits
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
12 changes: 10 additions & 2 deletions sentry_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,11 @@ def _prepare_event(
event = serialize(event)

before_send = self.options["before_send"]
if before_send is not None and event.get("type") != "transaction":
if (
before_send is not None
and event is not None
and event.get("type") != "transaction"
):
new_event = None
with capture_internal_exceptions():
new_event = before_send(event, hint or {})
Expand All @@ -336,7 +340,11 @@ def _prepare_event(
event = new_event # type: ignore

before_send_transaction = self.options["before_send_transaction"]
if before_send_transaction is not None and event.get("type") == "transaction":
if (
before_send_transaction is not None
and event is not None
and event.get("type") == "transaction"
):
new_event = None
with capture_internal_exceptions():
new_event = before_send_transaction(event, hint or {})
Expand Down