graphql-java-generator / graphql-maven-plugin-project

graphql-maven-plugin is a Maven Plugin for GraphQL, based on graphql-java. It accelerates the development for both the client and the server, by generating the Java code. It allows a quicker development when in contract-first approach, by avoiding to code the boilerplate code.
https://graphql-maven-plugin-project.graphql-java-generator.com
MIT License
115 stars 47 forks source link

Error extensions from generated client response #176

Closed amalfatti closed 1 year ago

amalfatti commented 1 year ago

Is there any way to recover extensions field from errors returned by a generated client? Currently a GraphQLRequestExecutionException exception is thrown which reports only the original error message. It would actually be useful to have the ability to custom handle the graphql error.

For example, my response is something like:

{
  "data": null,
  "errors": [
    {
      "message": "Table is not migrated",
      "extensions": {
        "errorType": "NOT_MIGRATED",
        "table": "tableName"
      }
    }
  ]
}

GraphQLRequestExecutionException only report message "Table is not migrated".

etienne-sf commented 1 year ago

You are right: there is currently no way to retrieve the extension associated to an error.

I'll change that.

Etienne

amalfatti commented 1 year ago

Great! Thank you

etienne-sf commented 1 year ago

Released in the 1.18.10 version