Skip to content
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

Local Resolvers: Support returning errors and data together for partial results #416

Open
irond13 opened this issue Jan 11, 2024 · 0 comments
Labels
core Feature requests related to core functionality

Comments

@irond13
Copy link

irond13 commented Jan 11, 2024

I have a use case where I use local resolvers to proxy and then enrich/transform other server side fields.

An example would be a field implementing the Relay Connections spec. My Local Resolver first fetches the server side data using client.query against a Relay spec compliant server field, after which it will do some combo of client side filtering/sorting/aggregation.

This "upstream" GQL call can return a combo of usable data and errors. E.g. if some of the list items - AKA edges - couldn't be resolved, we received path specific errors for those and data fields for the rest.
The local resolver ideally should return the processed data for the data fields it did receive, while also return (transformed) errors for the missing upstream edges.

Currently this is not possible with local resolvers since they can only have two resolution states: 1) success if the resolver returns or 2) error if it throws.

What I had in mind is something like the DataFetcherResult from GraphQL Java, which allows one to return both data and errors together: https://www.graphql-java.com/documentation/execution#returning-data-and-errors

@jerelmiller jerelmiller added the core Feature requests related to core functionality label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Feature requests related to core functionality
Projects
None yet
Development

No branches or pull requests

2 participants