-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Returning rejected promises in HttpConnection #8315
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few things you should look at.
} | ||
|
||
private constructTransport(transport: HttpTransportType) { | ||
switch (transport) { | ||
switch (transport) { | ||
case HttpTransportType.WebSockets: | ||
if (!this.options.WebSocket) { | ||
throw new Error("'WebSocket' is not supported in your environment."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this throw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the ones in resolveTransport
and resolveUrl
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors in constructTransport and resolveTransport are caught and aggregated into a rejected Promise. resolveUrl
is only used in the constructor so that should be fine just throwing an error
Fixes: #7465
We were throwing in places we should have been returned rejected promises.