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

Cleanup error related code #1914

Merged
merged 6 commits into from
Jun 28, 2022
Merged

Commits on Jun 28, 2022

  1. Reuses GraphQLErrorOptions in own error code

    We had a `GraphQLErrorArgs` type that was almost equivalent to the
    graphql-js `GraphQLErrorOptions`, and the reason being that the
    later was added recently-ish, but keeping that slight inconsistency
    doesn't make sense and this commit fixes.
    
    It does imply mimicking the new `GraphQLError` constructor signature
    which have the message first and the options, while we had put the
    message inside the options on our side, so this imply changing all
    the call sites, but it's one-off easy-if-annoying fix, so just went
    with it.
    Sylvain Lebresne committed Jun 28, 2022
    Configuration menu
    Copy the full SHA
    490cdd9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9944be8 View commit details
    Browse the repository at this point in the history
  3. Removes error() method from defintion.ts

    That `error` was early that never was kept up-to-date with other
    changes. In practice, it was called in one of 2 ways:
    1. to check for code assertions (programmer errors). We have an
       `assert` method we use for this consistently and this commit use
       it for those usages.
    2. for genuine graphql errors. But for those, we weren't giving
      a proper error code, so this commit switch to using the machinery from
      `error.ts` to handle those.
    
    The result being that this `error()` method has been removed.
    Sylvain Lebresne committed Jun 28, 2022
    Configuration menu
    Copy the full SHA
    14654f8 View commit details
    Browse the repository at this point in the history
  4. Make core more DRY

    Noticed while working on the errors that we were duplicating the error
    code that handled errors during the validation of a "field set", and
    that's easy enough to make dryer.
    Sylvain Lebresne committed Jun 28, 2022
    Configuration menu
    Copy the full SHA
    609641d View commit details
    Browse the repository at this point in the history
  5. Error doc update

    Sylvain Lebresne committed Jun 28, 2022
    Configuration menu
    Copy the full SHA
    ba9ab2b View commit details
    Browse the repository at this point in the history
  6. Typos and changelog

    Sylvain Lebresne committed Jun 28, 2022
    Configuration menu
    Copy the full SHA
    a676502 View commit details
    Browse the repository at this point in the history