Skip to content

Commit

Permalink
Catch to prevent push-receiver crash on disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Sightler committed Nov 25, 2024
1 parent 0fec12e commit 78fd786
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/ring-client-api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,15 @@ export class RingApi extends Subscribed {
}),
)

pushReceiver.on('ON_DISCONNECT', () => {
pushReceiver.whenReady

Check failure on line 296 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (22)

Delete `⏎········`

Check failure on line 296 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (20)

Delete `⏎········`

Check failure on line 296 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (18)

Delete `⏎········`
.catch((e) => {
logError('Connection to the push notification server has failed unexpectedly')

Check failure on line 298 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (22)

Replace `··logError('Connection·to·the·push·notification·server·has·failed·unexpectedly')` with `logError(⏎··········'Connection·to·the·push·notification·server·has·failed·unexpectedly',`

Check failure on line 298 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (20)

Replace `··logError('Connection·to·the·push·notification·server·has·failed·unexpectedly')` with `logError(⏎··········'Connection·to·the·push·notification·server·has·failed·unexpectedly',`

Check failure on line 298 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (18)

Replace `··logError('Connection·to·the·push·notification·server·has·failed·unexpectedly')` with `logError(⏎··········'Connection·to·the·push·notification·server·has·failed·unexpectedly',`
logError('If this happens repeatedly, verify connections to TCP/5228 are allowed and that DNS Adblock rules allow gtalk.google.com')

Check failure on line 299 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (22)

Replace `···logError('If·this·happens·repeatedly,·verify·connections·to·TCP/5228·are·allowed·and·that·DNS·Adblock·rules·allow·gtalk.google.com')` with `·)⏎········logError(⏎··········'If·this·happens·repeatedly,·verify·connections·to·TCP/5228·are·allowed·and·that·DNS·Adblock·rules·allow·gtalk.google.com',`

Check failure on line 299 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (20)

Replace `···logError('If·this·happens·repeatedly,·verify·connections·to·TCP/5228·are·allowed·and·that·DNS·Adblock·rules·allow·gtalk.google.com')` with `·)⏎········logError(⏎··········'If·this·happens·repeatedly,·verify·connections·to·TCP/5228·are·allowed·and·that·DNS·Adblock·rules·allow·gtalk.google.com',`

Check failure on line 299 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (18)

Replace `···logError('If·this·happens·repeatedly,·verify·connections·to·TCP/5228·are·allowed·and·that·DNS·Adblock·rules·allow·gtalk.google.com')` with `·)⏎········logError(⏎··········'If·this·happens·repeatedly,·verify·connections·to·TCP/5228·are·allowed·and·that·DNS·Adblock·rules·allow·gtalk.google.com',`
logError(e.message)

Check failure on line 300 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (22)

Insert `······)⏎`

Check failure on line 300 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (20)

Insert `······)⏎`

Check failure on line 300 in packages/ring-client-api/api.ts

View workflow job for this annotation

GitHub Actions / build (18)

Insert `······)⏎`
})
})

try {
await pushReceiver.connect()
} catch (e) {
Expand Down

0 comments on commit 78fd786

Please sign in to comment.