Skip to content

Returning Partial Success, with error message. #5162

Answered by bo55vxr
bo55vxr asked this question in Q&A
Discussion options

You must be logged in to vote

Well, I'll answer my own question - You can build an error within the resolver and attach it to the request context.

descriptor.Field(fld => fld.Orders)
          .Resolve(async (cntx, ct) =>
          {
              try
              {
                  // Retrieve the customer's orders
                  return await _ordersProvider.Query(cntx.Parent<Models.Customer>().CustomerId);
              }
              catch
              {
                  // Unable to retrieve orders
                  cntx.ReportError(ErrorBuilder.New()
                                    .SetMessage("Unable to retrieve Customer's orders")
                                    .Build()
                      );…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bo55vxr
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