Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

docs: Document options for presenting validation error messages with the envelop Masked Error plugin #1363

Closed
dthyresson opened this issue Jan 6, 2022 · 1 comment
Assignees

Comments

@dthyresson
Copy link

dthyresson commented Jan 6, 2022

When implementing the ability add GraphQL Scalars to a RedwoodJS applications GraphQL schema (see: redwoodjs/redwood#4053) I found that the error message provided when a scalar fails validation is a TypeError wrapped as the original error of the GraphQL error when using the envelop Masked Error plug-in.

Need to document the options for how best to handle errors and messages when using the Masked Errors plug-in.

You can allow the error have a message like:

 Variable "$input" got invalid value "Roobles" at "input.currency_iso_4217"; Expected type "Currency". Value is not a valid currency value: Roobles

Or instead elect to use the original error message raised by the TypeError:

Value is not a valid currency value: Roobles

The former exposes field names (which is exactly what Masked Errors intends to prevent) while the latter is much more of a message that can be shared clients side in a HTML Form error message.

@ardatan
Copy link
Member

ardatan commented Mar 29, 2023

Now we are using GraphQLError instead of TypeError so the errors should not be masked now.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

2 participants