Throw errors#12
Open
ibash wants to merge 3 commits intoMatthieuLemoine:masterfrom
Open
Conversation
This commit: 1. Prevents sending messages to destroyed webContents (which result in a crash) 2. Allows registering multiple webContents for push notifications We need this because we are listening for notifcations in a specific webContents. If it crashes we create a new one and call setup again, without this change the next push notification that came in would cause a crash.
That seems to be crashing the app ref: electron/electron#11797
Owner
|
Can't we use NOTIFICATION_SERVICE_ERROR for this ? |
Author
|
I did that at first, but realized I actually wanted the errors in the main process, since that's where I have bugsnag set to catch them. I'm happy for this not to be merged into the main project, as it's kind of an odd use case, and I'm mostly doing it to help flush out any bugs with the changes to push-receiver. FWIW we're rolling the push-receiver changes, so it'll start getting some production testing :) |
| // Retrieve saved senderId | ||
| const savedSenderId = config.get('senderId'); | ||
| if (started) { | ||
| webContents.send(NOTIFICATION_SERVICE_STARTED, (credentials.fcm || {}).token); |
There was a problem hiding this comment.
Accessing 'fcm' from 'credentials' object will results in error when 'credentials' object is null.
can we re-write like ((credentials && credentials.fcm) || {}).token)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@MatthieuLemoine I made this change so that we can opt-in to throwing errors. We catch these and send them to bugsnag, so it should help with catching any edge cases in the gcm code.