graphql-flutter icon indicating copy to clipboard operation
graphql-flutter copied to clipboard

fetchMore error handling

Open micimize opened this issue 5 years ago • 7 comments

Basically, with our current implementation of fetchMore that uses apollo's approach, there is no way for the user to do error handling. In apollo they can .catch, but I don't think this is good enough - we should just pass both full results to updateQuery so that the user can handle or merge errors, etc however they want.

micimize avatar Aug 25 '19 23:08 micimize

So, instead of just passing the data, we pass the QueryResults and the user checks for errors both?

mainawycliffe avatar Aug 26 '19 18:08 mainawycliffe

@mainawycliffe yeah, and maybe have some helper on QueryResult for merging them, and some sane defaults

micimize avatar Aug 26 '19 21:08 micimize

Okay, I will work on this over the weekend.

mainawycliffe avatar Aug 28 '19 08:08 mainawycliffe

I will work on this tomorrow, am thinking of adding a onError callback with a default method, which merges the GraphQLError list, one can override it to handle errors differently.

mainawycliffe avatar Sep 07 '19 22:09 mainawycliffe

@micimize I started working on this and realized there was a PR on having Library level exceptions. Can I work off this PR or should I wait for you to merge it?

mainawycliffe avatar Sep 10 '19 09:09 mainawycliffe

@mainawycliffe the docs need to be reworked for lib level exceptions - idk when I'll get around to it

micimize avatar Sep 10 '19 18:09 micimize

Added a basic mechanism here – https://github.com/micimize/graphql-flutter/tree/fetch_more_errors

I still think the full result merge approach is better though.

micimize avatar Jan 24 '21 21:01 micimize