forked from creditkarma/thrift-server
-
Notifications
You must be signed in to change notification settings - Fork 0
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
thrift-client: improve non-200 response error handling #9
Merged
RobWiggins
merged 5 commits into
main
from
rwiggins/improve-non-200-thrift-errors-DCB-689
Jun 9, 2022
Merged
thrift-client: improve non-200 response error handling #9
RobWiggins
merged 5 commits into
main
from
rwiggins/improve-non-200-thrift-errors-DCB-689
Jun 9, 2022
Conversation
This file contains 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
strmer15
approved these changes
Jun 6, 2022
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.
Thanks!
mabranon
approved these changes
Jun 6, 2022
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.
LGTM
markdoliner-doma
approved these changes
Jun 6, 2022
markdoliner-doma
approved these changes
Jun 9, 2022
markdoliner-doma
added a commit
that referenced
this pull request
Jul 5, 2022
We [recently added some better exception handling](#9) but unfortunately printing the response body didn't work because [`response.text()` is a Promise](https://github.github.io/fetch/#response-body). The message looks like this: `ThriftRequestError: Thrift request failed: HTTP 503 Service Unavailable: [object Promise]` The fix is to use `.then()` to get the body.
markdoliner-doma
added a commit
that referenced
this pull request
Jul 6, 2022
We [recently added some better exception handling](#9) but unfortunately printing the response body isn't working because [`response.text()` is a Promise](https://github.github.io/fetch/#response-body). The message looks like this: `ThriftRequestError: Thrift request failed: HTTP 503 Service Unavailable: [object Promise]` The fix is to use `.then()` to get the body. I have not tested this. I did run `npm run test` and some of the tests pass, but 75 out of 108 thrift-integration tests fail. I'm seeing this error a lot: ``` request to http://localhost:8090/thrift failed, reason: connect ECONNREFUSED ::1:8090 ``` I think it also might have been happening before this change. It looks unrelated. It seems like it's happening because [Hapi listens on 127.0.0.1](https://hapi.dev/api/?v=20.2.2#-serveroptionsaddress) and [Node v17 and higher stopped forcing IPv64addresses to be listed first when resolving domains](nodejs/node#40537 (comment)) so now IPv6 addresses can be returned first. I'll probably post a separate PR for that, but for now I'd prefer not to block this change.
markdoliner-doma
added a commit
that referenced
this pull request
Jul 6, 2022
In #9 we changed thrift-client to return an instance of ThriftRequestError when the client gets an HTTP error. This commit exports the ThriftRequetsError class and fixes some test assertions in light of those changes. I feel good about it!
markdoliner-doma
added a commit
that referenced
this pull request
Jul 6, 2022
In #9 we changed thrift-client to return an instance of ThriftRequestError when the client gets an HTTP error. This commit exports the ThriftRequestError class and fixes some test assertions in light of those changes. I feel good about it!
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.
When a non-200 response is received, reject with a new
ThriftRequestError
, which is an instance of error.Rejecting with a payload that is an instance of an
Error
is the proper thing to do. Doma's logger handles this better.DCB-689