Skip to content
Discussion options

You must be logged in to vote

i figured it out and wanted to document an example for future people who might need support:

Overall:

  • i had to create a DataLoaderResult which has a success/error, set this using a try catch in your dataloader.load function
  • implement a mapping of my throwable errors to a graphql error
  • return the success mapped into data or error map into error inside a DataFetcherResult from within the child resolver, checking if error then return error DataFetcherResult

Note that you will need to implement your own createGraphQLError() from your throwable, there are examples of this in the apollo docs

public class DataLoaderResult<T> {
    private final T data;
    private final Throwable error;

    /…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tatianajiselle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant