Skip to content

docs: explain how to handle sendNotification() error status codes - #991

Open
SrijaVuppula wants to merge 2 commits into
web-push-libs:masterfrom
SrijaVuppula:docs/error-handling-guidance
Open

SrijaVuppula wants to merge 2 commits into
web-push-libs:masterfrom
SrijaVuppula:docs/error-handling-guidance

Conversation

@SrijaVuppula

Copy link
Copy Markdown

sendNotification() currently documents that a rejection carries statusCode,
headers, and body, but doesn't explain what to do with them. This adds a
short "Handling errors" section covering the status codes that matter most in
practice — distinguishing a permanently dead subscription (404/410, safe to
delete) from a transient failure worth retrying (429, 5xx) — with a small
code example.

No code changes, README only.

@marco-c

marco-c commented Sep 21, 2026

Copy link
Copy Markdown
Member

Can you reference the web push standards for the 4** errors?

Link each 4xx case in the "Handling errors" section to the section of
RFC 8030, RFC 8291, RFC 8292 or RFC 9110 that defines it, add the
401/403 VAPID case, and state the 413 limit precisely (4096 bytes of
payload body, at most 3993 bytes of plaintext with aes128gcm).
@SrijaVuppula
SrijaVuppula force-pushed the docs/error-handling-guidance branch from e3efab1 to 10980d3 Compare October 6, 2026 18:17
@SrijaVuppula

SrijaVuppula commented Oct 6, 2026 •

Copy link
Copy Markdown
Author

Thanks for the suggestion! I've added links to the relevant RFC sections for each of the 4xx cases.

A couple of things I changed while doing that:

The 413 note was a bit off. RFC 8030 says push services have to accept payloads up to 4096 bytes, and with aes128gcm that leaves about 3993 bytes for the actual message (RFC 8291), so I reworded it.
410 isn't actually in RFC 8030 (it only specifies 404 for expired subscriptions), but a lot of push services return 410, so I linked the HTTP spec for that one.
I also added a short bullet for 401/403 since those come up a lot with VAPID key mismatches.

Happy to drop the 401/403 part if you'd rather keep the PR focused on the original list.

@SrijaVuppula

Copy link
Copy Markdown
Author

Hi @marco-c, I’ve added the RFC references you asked for (plus a small fix to the 413 note). Whenever you have a moment, could you take another look? Happy to adjust or drop anything, including the 401/403 bullet.

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