Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

graphqlError: missing fields #139

Open
bsr203 opened this issue Sep 28, 2018 · 2 comments
Open

graphqlError: missing fields #139

bsr203 opened this issue Sep 28, 2018 · 2 comments

Comments

@bsr203
Copy link

bsr203 commented Sep 28, 2018

Hi,

I was trying to extend the graphql error to have custom error codes. In this blog post, Apollo engineer explains how they use extensions field for that. I don't use Apollo Server, so don't know currently how they do it. Still, the error type in reason-apollo doesn't define all fields.

currently it is defined as

type graphqlError = {
  .
  "message": string,
  "locations": Js.Nullable.t(array(string)),
  "path": Js.Nullable.t(array(string)),
  "nodes": Js.Nullable.t(array(string)),
};

Apollo client defines it here as

graphQLErrors?: GraphQLError[];

GraphQLError is defined at graphql-js as

  message: string,
    nodes?: $ReadOnlyArray<ASTNode> | ASTNode | void,
    source?: ?Source,
    positions?: ?$ReadOnlyArray<number>,
    path?: ?$ReadOnlyArray<string | number>,
    originalError?: ?Error,
    extensions?: ?{ [key: string]: mixed },

It will be great to have extensions and the other missing fields.

thanks.

@fakenickels
Copy link
Contributor

fakenickels commented Dec 13, 2018

would you mind sending us a PR including those?

@bsr203
Copy link
Author

bsr203 commented Dec 14, 2018

sorry. I am not using this library anymore as decided to stick with typescript. Please close this if it is not affected by other users.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants