Skip to content

errors plugin and apollo server errors #206

Answered by hayes
mmahalwy asked this question in Q&A
Discussion options

You must be logged in to vote

@mmahalwy I don't think that will work, generally you won't be throwing an apollo error inside you resolvers, so the errors plugin would not catch those errors.

There are effectively 3 options:

  1. Move everything that can throw into your revolvers (including authentication, authorization), not sure if this is already what you are doing. And then add handling and then use the errors plugin on every field/query/mutation that can throw, and have everything become a union. I personally don't love this approach, because it kinda bloats your schema, and clients will likely implement some generic handling that doesn't take advantage of the errors being typed anyway.
  2. Don't use the errors plugin. Er…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by hayes
Comment options

You must be logged in to vote
1 reply
@hayes
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #205 on November 03, 2021 21:56.