Django Graphene Custom Error not showing extensions

I am using graphene_django and I am interested in having custom errors being raised

What I am trying is:

class CustomGraphQLError(GraphQLError):
    def __init__(self, message, extensions, nodes=None, source=None, positions=None, path=None, original_error=None):
        super().__init__(message, nodes, source, positions, path, original_error, extensions)

and then raising an error like this

raise CustomGraphQLError

Despite I have made extensions mandatory, they don't seem to appear in the response

Example response

{
  "errors": [
    {
      "message": "Custom error",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "traces"
      ]
    }
  ],
  "data": {
    "traces": null
  }
}

Can't understand whats wrong here

Back to Top