smallrye / smallrye-graphql

Implementation for MicroProfile GraphQL
Apache License 2.0
159 stars 91 forks source link

Make it possible to add custom extensions to errors #773

Closed piotrblasiak closed 3 years ago

piotrblasiak commented 3 years ago

It would be great to be able to add extensions to errors. Some useful extensions that I use in other graphql apis:

reference - generated by the error handler on every time the error is logged and shown to the end-user they can send to the app support and get help. userFriendlyMessage - "Your account has been disabled." or other end-user oriented messages.

t1 commented 3 years ago

Thanks for the input.

reference - generated by the error handler on every time the error is logged and shown to the end-user they can send to the app support and get help.

RFC-7807 "Problem Details for HTTP APIs" defines a similar field, but calls it instance. They suggest this to be a URI, of course, as it's for REST, but it can actually be useful to directly have a URL you can 'click on' to see the logs (if you have the privileges to see them).

We've been discussing this briefly in #299.

userFriendlyMessage - "Your account has been disabled." or other end-user oriented messages.

There's already the message field for this purpose. The exception message is used for that, if the exception is in the mp.graphql.showErrorMessage configuration, or it's a checked exception and not in the mp.graphql.hideErrorMessage configuration.

If you agree, we could move the discussion to #299 and close this as a duplicate?

piotrblasiak commented 3 years ago

I agree that this is a duplicate and we can move the discussion to #299.