In GraphQL php library that Api platform is using it user can define custom error format.
Here is documentation for custom errors in php GraphQL library:
https://webonyx.github.io/graphql-php/error-handling/#custom-error-handling-and-formatting
I think we should add this feature so developers can create their own error formats based on exceptions.
Example 1: We don't have status codes for errors and I think its helps if we return a status property in error object so frontend developer can decide how to show it .
Example 2: Validation errors format isn't good now. All of error massages concat in one string and frontend developer needs to do some process on error string on every error messages.
Having a way to customize the errors would be indeed a nice improvement.
I'll try to create pull request for it.
This is actually a pretty important issue, since right now errors get completely swallowed in production environments, and there's no easy way to handle them (at least I didn't find one).
I have temporarily overridden the api_platform.graphql.executor service, and added my error handling logic there - for anyone that needs a quick solution 馃檪
Most helpful comment
This is actually a pretty important issue, since right now errors get completely swallowed in production environments, and there's no easy way to handle them (at least I didn't find one).
I have temporarily overridden the
api_platform.graphql.executorservice, and added my error handling logic there - for anyone that needs a quick solution 馃檪