Skip to content

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

Open
xavdid-stripe wants to merge 2 commits intomasterfrom
DEVSDK-3032
Open

⚠️ Throw an error when using the wrong webhook parsing method#2041
xavdid-stripe wants to merge 2 commits 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:50
@xavdid-stripe xavdid-stripe requested review from jar-stripe and removed request for a team March 19, 2026 23:50
@xavdid-stripe xavdid-stripe enabled auto-merge (squash) March 19, 2026 23:50
@xavdid-stripe xavdid-stripe requested review from prathmesh-stripe and removed request for jar-stripe March 20, 2026 00:00
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.

1 participant