You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(webhooks): unify webhook errors under InvalidWebhookException (CHA-3071)
Per cross-SDK coordination (mogita's review on all 6 sibling SDK PRs),
every webhook failure path now terminates at a single exception class.
Customers only need one catch arm and can filter by getMessage() text
for mode-specific behaviour.
Renames the previously-unreleased WebhookSignatureException to
InvalidWebhookException (still extends StreamException) and threads it
through every primitive:
verifyAndParseWebhook -> 'signature mismatch'
gunzipPayload -> 'gzip decompression failed'
decodeSqsPayload -> 'invalid base64 encoding'
parseEvent -> 'invalid JSON payload'
verifySignature keeps its boolean return at the primitive layer; the
composite verifyAndParse* helpers throw on mismatch. The legacy
Client#verifyWebhook helper (bool return) is untouched.
Co-authored-by: Cursor <cursoragent@cursor.com>
Detection is done via the gzip magic bytes (`1f 8b`, per RFC 1952), so the same helper stays correct whether or not your HTTP server already decompressed the body for you. Any non-gzip body is passed through unchanged. Malformed gzip envelopes raise an `IllegalStateException`.
125
+
Detection is done via the gzip magic bytes (`1f 8b`, per RFC 1952), so the same helper stays correct whether or not your HTTP server already decompressed the body for you. Any non-gzip body is passed through unchanged. Every webhook ingestion primitive (`gunzipPayload`, `decodeSqsPayload`, `decodeSnsPayload`, `parseEvent`, and the `verifyAndParse*` helpers) raises `InvalidWebhookException` on failure — one catch arm covers signature mismatches, malformed gzip envelopes, invalid base64, and invalid JSON; the failure-mode message constants on the exception class let callers branch when needed.
0 commit comments