grpc-web icon indicating copy to clipboard operation
grpc-web copied to clipboard

Catch exception thrown when cancelling fetch in grpc-web client

Open jrhee17 opened this issue 5 years ago • 1 comments

grpc-web-client.umd.js:1 Uncaught (in promise) DOMException: The user aborted a request.

I'm seeing this log in the browser when cancelling a grpc-web request. Since reader.cancel() returns a promise, I am guessing the cancellation is scheduled, and subsequently logged.

Changes

Add a catch statement when aborting a fetch response reader.

Verification

Verified from my local, I am assuming regressions will be checked via existing unit tests.

grpc-web-client.umd.js:1 onHeaders.gRPCStatus 16
grpc-web-client.umd.js:1 onHeaders.code 16
grpc-web-client.umd.js:1 onHeaders.gRPCMessage [...]
grpc-web-client.umd.js:1 rawOnHeaders e {headersMap: {…}}
pollEpic.ts:39 e {headersMap: {…}}
grpc-web-client.umd.js:1 rawOnError 16 user doesn't exist
grpc-web-client.umd.js:1 request.abort aborting request
grpc-web-client.umd.js:1 Fetch.abort.cancel before reader
grpc-web-client.umd.js:1 Fetch.pump.cancel at first pump
grpc-web-client.umd.js:1 Fetch.pump.cancel caught DOMException: The user aborted a request.

jrhee17 avatar Nov 27 '20 08:11 jrhee17

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: To complete the pull request process, please assign You can assign the PR to them by writing /assign in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

improbable-prow-robot avatar Nov 27 '20 08:11 improbable-prow-robot