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

Custom scalar parser errors #1187

Merged

Conversation

maartenvanvliet
Copy link
Contributor

See #856

The parse/1 could only return :error in case of a failure when parsing a custom scalar. This PR fixes that by also allowing an error tuple as a return value.

The error is stored in the flag instead of the errors field. This was more in line with how the current code was set up. The cases where the parse error handles in input objects and input lists are also handled.

@benwilson512
Copy link
Contributor

@maartenvanvliet I'm generally 👍 to this, what's the consensus amongst the other implementations with respect to this feature?

@maartenvanvliet
Copy link
Contributor Author

The graphql reference implementation supports custom errors, e.g.: https://github.com/graphql/graphql-js/blob/main/src/type/scalars.ts#L29

The ruby implementation as well: https://github.com/rmosolgo/graphql-ruby/blob/master/lib/graphql/types/iso_8601_date_time.rb#L49

@maartenvanvliet maartenvanvliet mentioned this pull request Sep 5, 2022
7 tasks
@benwilson512 benwilson512 merged commit 695c6d7 into absinthe-graphql:master Sep 5, 2022
@benwilson512
Copy link
Contributor

Great, thanks!

@maartenvanvliet maartenvanvliet deleted the custom-parser-errors branch September 6, 2022 05:43
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.

3 participants