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

Non-UserError/UserWarning exceptions are considered as internal #1194

Open
theofidry opened this issue Oct 14, 2024 · 0 comments
Open

Non-UserError/UserWarning exceptions are considered as internal #1194

theofidry opened this issue Oct 14, 2024 · 0 comments

Comments

@theofidry
Copy link
Contributor

Q A
Bug report? not sure
Feature request? not sure
BC Break report? not sure
RFC? no
Version/Branch 1.6.0

If I understand the error handling correctly based on Overblog\GraphQLBundle\Error\ErrorHandler, we have:

  • and error converter to completely transform an error object into another if desired
  • the result extensions that is populated by formatted errors
  • if rethrow_internal_exceptions = true, the formatting may be skipped and instead an error, if not a GraphQL\Error\UserError | Overblog\GraphQLBundle\Error\UserWarning

I am wondering a bit of the usage of rethrow_internal_exceptions as I assume on a production system you would not want to return a non-GraphQL response to a GraphQL query, so I was under the impression this was either for exception specific use cases or for dev/tests, as it is easier to deal with the original exception.

However, based on the implementation of the error handler, this cannot be because as soon as you throw an exception, if it is not a UserError or UserWarning, with rethrow_internal_exceptions = true, it will rethrow. As a result, something like a validation error (a Overblog\GraphQLBundle\Validator\Exception\ArgumentsValidationException) will bubble up instead of being formatted nicely.

Wouldn't it make more sense to consider as "internal" exceptions that are not ClientAware or ClientAware with isClientSafe = false instead?

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

1 participant