[PROPOSAL] Add errorPolicy option to throw errors of partially successful requests
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
In regards to https://github.com/facebook/relay/issues/3598 I don't see the way to access errors when partially successful response is returned.
So I propose to add option `errorPolicy` like `fetchPolicy` or `renderPolicy`.
The values can be:
- `default` | `partial`
- `full-only` | `full-and-partial`
- `full` | `partial`
For example:
```
const data = useLazyLoadQuery(query, vars, { errorPolicy: 'partial' })
```
The main idea is to enable throwing error when partial success happens.
Ideally we would return both data and error from the hook. And ideally fragments would support errors on them.
```
const { data, error } = useLazyLoadQuery(query, vars, { errorPolicy: 'partial' })
// and
const { data, error } = useFragment(fragment, fragmentOwner)
```
Or maybe even new hook instead?
```
const { data, error } = useLazyLoadQueryWithPartialErrors(query, vars)
```
Contributor guide
Assessment
This issue has not been assessed yet.