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

Structured errors for parsing overflowing ints #2921

Merged
merged 6 commits into from Jun 1, 2022

Conversation

dpetrick
Copy link
Contributor

@dpetrick dpetrick commented May 12, 2022

Related issues:

Makes sure the engine doesn't crash on encountering an integer serialized as float that is outside of the i64 range (surfaced as P2009). Introduces a less concrete P2033 error code for when the GraphQL parser errors on an int that doesn't fit. The reason for the separate error is that we have very little actual information on that parsing stage, plus the later parsing error (where the unwrap tickets point to) is on a completely different layer with more info, which can't easily be propagated as a different error code than the enclosing parser error (P2009).

Example P2009:

Unable to fit float value (or large JS integer serialized in exponent notation) '100000000000000000000' into a 64 Bit signed integer for field 'int'. If you're trying to store large integers, consider using `BigInt`

Example P2033:

A number used in the query does not fit into a 64 bit signed integer. Consider using `BigInt` as field type if you're trying to store large integers.

@dpetrick dpetrick added this to the 3.15.0 milestone May 12, 2022
Copy link
Member

@Weakky Weakky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm flooded with serotonin seeing all those issues about to be closed. Nice impactful work, lgtm 👍

Copy link
Contributor

@garrensmith garrensmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Once you fixed the clippy complaints this should be good to go.

query-engine/request-handlers/src/graphql/body.rs Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants