Skip to content
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

Return more verbose error to the caller #99

Open
rjjatson opened this issue Nov 4, 2022 · 1 comment
Open

Return more verbose error to the caller #99

rjjatson opened this issue Nov 4, 2022 · 1 comment

Comments

@rjjatson
Copy link

rjjatson commented Nov 4, 2022

Hi,
There is currently no way to differentiate between various errors when doing a query/ mutation except from the error messages.

As error messages from the resource server are sometimes dubiety, some resource server does return error code on the extensionsfield so that the callers could identify the errors. Thus, I believe it would be very convenient if this package could provide a way to let the caller get the error's extensions value.

I am thinking something like what aws sdk does on their awserr. I would like to do something like this :

if err != nil {
    if gqlErr, ok := err.(graphql.Error); ok {
        // process error
        // if gqlErr.Code() == ...
    }
}

So im taking my chance to ask if there is any possibility that you could export the graphql.errors type and let the caller get whatever it is inside the extension? I could try to implement it if the idea sounds worth to do.
Or at least i would like to hear your opinion about handling various errors from the resource server.

Thanks !

@rjjatson
Copy link
Author

#98
i believe having that one PR released would do the job.
wonder if any maintainers noticed it @dmitshur

alexandear pushed a commit to alexandear/graphql that referenced this issue Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant