Skip to content

Add .preHandle method to EventNotificationHandler - #2274

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

Add .preHandle method to EventNotificationHandler#2274
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 justiny-stripe and removed request for a team August 22, 2026 00:56
@xavdid xavdid changed the title Add .pre_handle method to EventNotificationHandler Add .preHandle method to EventNotificationHandler Aug 22, 2026
@xavdid
xavdid enabled auto-merge (squash) August 22, 2026 01:11
@xavdid
xavdid requested a review from jar-stripe August 24, 2026 22:13
@xavdid
xavdid merged commit a87e544 into master Aug 25, 2026
26 of 27 checks passed
@xavdid
xavdid deleted the DEVSDK-3249 branch August 25, 2026 02:49
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