fix(fcm): Wrap HTTP/2 session errors in promise by jonathanedey · Pull Request #2868 · firebase/firebase-admin-node
RELEASE NOTE: Fixed a issue which caused session errors not to be thrown.
- Promise wrapped HTTP/2 session errors allowing them to be caught as a
FirebaseMessagingSessionError - Added
pendingBatchResponsefield to newFirebaseMessagingSessionErrorto allow access to the status of messages which were in flight at error time.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Jonathan! Added one comment
| // Start session listeners | ||
| http2SessionHandler.invoke().catch((error) => { | ||
| const pendingBatchResponse = | ||
| sendResponsePromise ? sendResponsePromise.then(this.parseSendResponses) : undefined; |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just thinking out loud, if a session error occurs before any of the requests have gone through would pendingBatchResponse be undefined?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this would be undefined.
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