feat(pwa): add more errors and elk repo link in push notifications subscription errors (#1610)

This commit is contained in:
Joaquín Sánchez 2023-02-04 19:43:24 +01:00 committed by GitHub
parent 2cf8f591e8
commit 0cc4c41315
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 7 deletions

View file

@ -46,9 +46,9 @@ export const createPushSubscription = async (
if (error.code === 11 && error.name === 'InvalidStateError')
useError = new PushSubscriptionError('too_many_registrations', 'Too many registrations')
else if (error.code === 20 && error.name === 'AbortError')
console.error('Your browser supports Web Push Notifications, but does not seem to implement the VAPID protocol.')
useError = new PushSubscriptionError('vapid_not_supported', 'Your browser supports Web Push Notifications, but does not seem to implement the VAPID protocol.')
else if (error.code === 5 && error.name === 'InvalidCharacterError')
console.error('The VAPID public key seems to be invalid:', vapidKey)
useError = new PushSubscriptionError('invalid_vapid_key', `The VAPID public key seems to be invalid: ${vapidKey}`)
return getRegistration()
.then(getPushSubscription)