Skip to content

Add .pre_handle method to EventNotificationHandler - #1885

Merged
xavdid merged 2 commits into
masterfrom
DEVSDK-3249
Aug 24, 2026
Merged

Add .pre_handle method to EventNotificationHandler#1885
xavdid merged 2 commits into
masterfrom
DEVSDK-3249

Conversation

@xavdid

@xavdid xavdid commented Aug 22, 2026

Copy link
Copy Markdown
Member

Why?

In final testing, users have expressed interest in being able to centrally run code before any other handler executes. It can be used for centralized logging, event deduplication, and more. I don't want to go full middleware, but this felt like a reasonable way to dip our toe into the waters.

Because users are responsible for deduplicating events, this pre-handle hook (if present) should return a bool, signifying whether handling should continue.

If the function returns true (or is missing entirely), the handler proceeds like normal (running at-most-one other callback). If it returns false, no further callback is run and the original .handle() call finishes cleanly.

What?

  • add the .pre_handle method
  • & associated tests
  • update some error messages with correct verbs & consistency
  • refactored some internal error handling
  • updated example

See Also

@xavdid
xavdid requested a review from a team as a code owner August 22, 2026 00:56
@xavdid
xavdid requested review from jar-stripe and removed request for a team August 22, 2026 00:56
Comment thread examples/event_notification_handler_endpoint.py Dismissed
@xavdid
xavdid enabled auto-merge (squash) August 22, 2026 01:11

@jar-stripe jar-stripe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved to unblock, but see the comment

Comment thread examples/event_notification_handler_endpoint.py
@xavdid
xavdid merged commit 87fb85b into master Aug 24, 2026
17 checks passed
@xavdid
xavdid deleted the DEVSDK-3249 branch August 24, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants