-
Notifications
You must be signed in to change notification settings - Fork 527
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
Allow subscription config errors to return spec compliant errors #1340
Comments
Thanks @bryanjos! We've already discussed, but I'll add my thoughts here as well. I encountered unexpected behavior with My take is that the IMO, while this option is convenient, it's a bit surprising that Absinthe reformats errors in this way. A simpler approach would be to make the If folks prefer the @maartenvanvliet I know it's been a while since this PR, but curious if you have opinions here. |
Knowing the history now, I think I'd back what @michaelcaterisano suggests. |
Made a PR #1341 |
Currently subscription config functions expect either
{:ok, config}
or{:error, msg}
to be returned. In the error case, this is what's returned ultimately:We would like to send spec compliant errors with extra information from the config errors.
Right now if we return the following from config
We get
Which breaks some tools that expect spec compliant errors.
There are a couple of ways we've thought about fixing it and could use some feedback before making a PR.
The first way would be to update
Absinthe.Phase.Document.Result
to look for a map in themessage
property of theAbsinthe.Phase.Error
struct created and return what's there as the error.So returning
{:error, %{extensions: %{code: "FAILED"}, message: "failed"}
from the config function would giveThe second way we were thinking is updating
Absinthe.Phase.Subscription.SubscribeSelf
to let config return a 3-tuple,{:error, msg, extra}
and put theextra
there onto theextra
property of theAbsinthe.Phase.Error
struct created.With that, and with
spec_compliant_errors
set to true, if{:error, "failed", %{code: "FAILED"}
is returned, you would get the above as well.Or some other way we aren't thinking of.
The text was updated successfully, but these errors were encountered: