-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
make afterware errors bubble up #982
make afterware errors bubble up #982
Conversation
956df32
to
8779f20
Compare
@edvinerikson Thanks for the PR! Can you explain what problem this solves and add a test case if applicable? Right now it doesn't look like your PR would change any behavior. |
Looks like the change makes it so that the promise returns the return value of the afterware. However this should definitely come with a test that ensures the behavior continues to work, especially since it's so easy to miss. |
Yeah I will add a test. I just need to fix my local setup first. Can't run
it locally due to TS errors.
…On Fri, 2 Dec 2016 at 23:55, Sashko Stubailo ***@***.***> wrote:
Looks like the change makes it so that the promise returns the return
value of the afterware. However this should definitely come with a test
that ensures the behavior continues to work, especially since it's so easy
to miss.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#982 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADtdjIkVxD0gvTIVN8hR7lwS3Y2vvHcNks5rEKHHgaJpZM4LCi3H>
.
|
@helfer the reason for the change is because I have a afterware which I check the response status and decide if Apollo will be able to parse the response. in some cases Apollo won't be able to do that and when that happens I throw a error which I can catch in my error handling but without this change I am not able to catch the error and instead Apollo will fail with when trying to parse the json body. e.g |
maybe a improvement to the network layer would be to check currently I do this in my afterware |
@edvinerikson Okay. Please add a test, and then we can merge it. I think checking response.ok won't work, because some people return error codes that are not in the 200 range for responses that should be parsed and processed. It's unfortunate, but I think we have to live with that for now. |
Yeah I will create my own network layer to handle my cases instead. |
test is added |
8779f20
to
0a898f9
Compare
Sweet, thanks a lot! |
This makes errors thrown from afterwares bubble up so that apollo don't try to parse bad responses.
TODO: