Skip to content

Throwing errors from parseLiteral #910

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

Closed
Cardinal90 opened this issue Jun 14, 2017 · 5 comments
Closed

Throwing errors from parseLiteral #910

Cardinal90 opened this issue Jun 14, 2017 · 5 comments

Comments

@Cardinal90
Copy link

After 0.10.1 throwing GraphQLError from parseLiteral function in a custom scalar type leads to unhandled promise rejection. Tracked it down to this commit: 62619df#diff-e896d5930c71857fc9566b22defba666
Parsing has a try-catch block around it, but validation does not. Doesn't seem like it was intended, considering it says "refactor".

@helfer
Copy link
Contributor

helfer commented Jun 29, 2017

Just ran into this in apollographql/apollo-server#381.

@exogen
Copy link
Contributor

exogen commented Aug 16, 2017

Definitely not intended as far as I can tell, considering the purpose of the refactor was to ensure that "internal errors throw and GraphQL user errors are returned within the GraphQL Result" – in this case, the purpose of throwing from a custom scalar type is to inform the user that they've provided invalid input. I noticed this because it's making a couple of my graphbrainz specs fail. /cc @leebyron

@tkiethanom
Copy link

+1

Getting "Internal Server Error" when throwing an error inside of parseLiteral.

@LuisUrrutia
Copy link

Any news on this?

@leebyron
Copy link
Contributor

leebyron commented Dec 7, 2017

Validate should always return safely and not throw. Is this still an issue? In the future please escalate by submitting a PR with a failing test case or better yet a fix.

leebyron added a commit that referenced this issue Dec 7, 2017
Fixes #910

This factors out the enum value validation from scalar value validation and ensures the same try/catch is used in isValidLiteralValue as isValidJSValue and protecting from errors in valueFromAST.
leebyron added a commit that referenced this issue Dec 7, 2017
Fixes #910

This factors out the enum value validation from scalar value validation and ensures the same try/catch is used in isValidLiteralValue as isValidJSValue and protecting from errors in valueFromAST.
leebyron added a commit that referenced this issue Dec 7, 2017
Fixes #910

This factors out the enum value validation from scalar value validation and ensures the same try/catch is used in isValidLiteralValue as isValidJSValue and protecting from errors in valueFromAST.
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

No branches or pull requests

6 participants