Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Add Clarity around Http Link Errors #244

Merged
merged 9 commits into from
Nov 27, 2017
Merged

Add Clarity around Http Link Errors #244

merged 9 commits into from
Nov 27, 2017

Conversation

evans
Copy link
Contributor

@evans evans commented Nov 14, 2017

We add the result to network and data errors along with documenting errors in the http link's README. This error documentation used to happen in Apollo Fetch and since we are no longer using it the behavior should be present here.

This modifies the error types in a backwards incompatible manner, removing the nullable fields from a client parse error.

The PR also adds a couple changes to the docs README to detail how to run them locally.

  • If this PR is a new feature, reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass
  • Update CHANGELOG.md with your change
  • Add your name and email to the AUTHORS file (optional)
  • If this was a change that affects the external API, update the docs and post a link to the PR in the discussion

@evans
Copy link
Contributor Author

evans commented Nov 14, 2017

I wasn't sure if I needed to bump the doc package.json, so I can if that is necessary and then document it in the docs README

@apollo-cla
Copy link

apollo-cla commented Nov 14, 2017

Messages
📖

Please add your name and email to the AUTHORS file (optional)

📖

If this was a change that affects the external API, please update the docs and post a link to the PR in the discussion

Generated by 🚫 dangerJS

@gpoitch
Copy link

gpoitch commented Nov 14, 2017

With these changes, you could also add graphQLErrors: networkError.result.errors to the errorHandler here:

error: networkError => {
errorHandler({
operation,
networkError,
});
observer.error(networkError);
},

Copy link
Contributor

@peggyrayzis peggyrayzis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR, it looks great! I had one minor comment, but overall this is good to merge. 😎


```
git clone --recursive https://github.com/apollographql/react-docs.git
cd react-docs
git submodule init
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for cleaning up the docs workflow instructions!! 🎉

@@ -69,7 +69,48 @@ client.query({
})
```

## Upgrading from `apollo-fetch` / `apollo-client`
## Errors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention apollo-link-error in this section as the official way to handle errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thought!

Copy link
Contributor

@jbaxleyiii jbaxleyiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! A much clearer way of reporting errors! Thank you!

parseError.statusCode = response.status;

throw parseError;
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly what I needed ^ ! thanks so much for these changes @evans

| GraphQL Error | `next` | `` |

```js
type ServerError = Error & {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer something less oriented towards Flow/TS users here - maybe some example error objects?

};
```

## Upgrading from `apollo-fetch` / `apollo-client`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think apollo-client in this heading is a bit misleading - maybe createNetworkInterface?

This list describes the different errors and what the response Observable calls:

* Client parse errors: the request body is not-serializable due to circular references for example
* Server parse errors: the response from the server cannot be parsed((response.json())[https://developer.mozilla.org/en-US/docs/Web/API/Body/json])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this link is mis-formatted - probably worthwhile to look at the deploy preview or run locally

@evans
Copy link
Contributor Author

evans commented Nov 17, 2017

@gpoitch That is an incredible thought! I added the alias in.

@peggyrayzis @jbaxleyiii I'm happy with the state of things. Let me know if you see anything else that needs attention.

@maurodelazeri
Copy link

Amazing!!! ty guys

@TomPridham
Copy link

is there an ETA for this to get merged and released?

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

Successfully merging this pull request may close these issues.

None yet

10 participants