Skip to content

⚠️ Throw an error when using the wrong webhook parsing method#1828

Merged
xavdid-stripe merged 1 commit intomasterfrom
DEVSDK-3032
Mar 23, 2026
Merged

⚠️ Throw an error when using the wrong webhook parsing method#1828
xavdid-stripe merged 1 commit intomasterfrom
DEVSDK-3032

Conversation

@xavdid-stripe
Copy link
Member

Why?

When users call the wrong webhook parsing method, the call usually works, but happily gives them a malformed object for their troubles. Rather than fail silently, we should fail loudly and help direct users to the correct method.

What?

  • throw error in each of constructWebhook and parseEventNotification if it's received the wrong type, pointing the user to the other method
  • add tests
  • adjust existing tests which used the wrong object type

See Also

@xavdid-stripe xavdid-stripe requested a review from a team as a code owner March 19, 2026 23:45
@xavdid-stripe xavdid-stripe requested review from prathmesh-stripe and removed request for a team March 19, 2026 23:45
@xavdid-stripe xavdid-stripe enabled auto-merge (squash) March 19, 2026 23:45
@xavdid-stripe xavdid-stripe merged commit 489e3f9 into master Mar 23, 2026
15 checks passed
@xavdid-stripe xavdid-stripe deleted the DEVSDK-3032 branch March 23, 2026 14:32
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