Skip to content

Returning too large of a number from Int resolver results in hard to debug errors #391

Closed
@stubailo

Description

@stubailo

If I have a field that is supposed to return GraphQLInt, then there are two hard-to-debug things that can happen if I return a number that's not within the allowed range, for example 1463692053071 (a timestamp):

  1. If the field is optional, then I simply get null on the client with no errors at all
  2. If the field is required, then I get the error: Cannot return null for non-nullable field Entry.createdAt. This is extra misleading since I didn't actually return null - I returned a Number that was simply too large.

Sounds like this can just be fixed by adding an error in the coerceInt function instead of silently returning null.

Metadata

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