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

Make it simpler in ExecutionDiagnosticEventListener.ResolverError to distinguish between server and client errors #7144

Open
cmeeren opened this issue Jun 5, 2024 · 3 comments
Labels
Milestone

Comments

@cmeeren
Copy link
Contributor

cmeeren commented Jun 5, 2024

Product

Hot Chocolate

Is your feature request related to a problem?

I want to log all server errors as errors, and all client errors at a lower severity level. However, ExecutionDiagnosticEventListener.ResolverError gives me no robust way to distinguish between them.

I originally tried to base this on whether the IError passed to ResolverError contains an exception, but this does then not log errors like HC0018 "Cannot return null for non-nullable field" as errors. I can of course add this code to the check, but adding error codes as I randomly discover that something is not logged as an error is no way to go about this.

The solution you'd like

I'm open to various solutions, but it could be something as simple as a property IError.IsServerError or IError.IsClientError.

@cmeeren cmeeren added the 🎉 enhancement New feature or request label Jun 5, 2024
@michaelstaib michaelstaib added this to the HC-14.0.0 milestone Jun 5, 2024
@michaelstaib
Copy link
Member

With client errors you really mean error that are caused by client inputs?

@cmeeren
Copy link
Contributor Author

cmeeren commented Jun 5, 2024

Yes, that is correct. Put another way, errors that according to normal HTTP semantics would give 4XX errors (and not 5XX errors). Or in yet other words: Errors where the client, not the server, is at fault.

@cmeeren
Copy link
Contributor Author

cmeeren commented Jun 19, 2024

Related: Error code HC0018 is used both when a required variable is missing (client error) and when the server tries to return null for a non-nullable field (server error).

So currently, for this error code, I have to also check the message in order to know whether to log this as an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants