Skip to content

Return more verbose error to the caller #99

Open
@rjjatson

Description

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 !

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions