Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error handling in xhrHttpClient #378

Open
xuke444 opened this issue Dec 6, 2019 · 1 comment
Open

error handling in xhrHttpClient #378

xuke444 opened this issue Dec 6, 2019 · 1 comment

Comments

@xuke444
Copy link

xuke444 commented Dec 6, 2019

in the rejectOnTerminalEvent of xhrHttpClient, when throw error for "error" event, the xhr.response is not passed, instead it passes undefined.
xhr.addEventListener("error", () => reject(new RestError(Failed to send request to ${request.url}, RestError.REQUEST_SEND_ERROR, undefined, request)));

can xhr.response be added to replace undefined above?
So that we can know the details of error to handle it correctly.

@jeremymeng
Copy link
Member

the third parameter of RestError constructor is statusCode. We could pass xhr.response as the last parameter, after request. One concern is that the error response may contain sensitive information and we probably don't want to leak everything in the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants