Skip to content

Add .pre_handle method to EventNotificationHandler - #1885

Open
xavdid wants to merge 1 commit into
masterfrom
DEVSDK-3249
Open

Add .pre_handle method to EventNotificationHandler#1885
xavdid wants to merge 1 commit 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
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.

2 participants