hasura_connect icon indicating copy to clipboard operation
hasura_connect copied to clipboard

HasuraError extensions error messages

Open aliboy-lala opened this issue 10 months ago • 1 comments

Hi, cannot get Hasura error extensions. Hasura response is as follow:

{
  "data": null,
  "errors": [
    {
      "extensions": {
        "classification": "DataFetchingException",
        "errorCode": 422,
        "errorMessages": [
          {
            "attribute": "E",
            "message": "Error message",
            "parameters": "{\"parameter\":20}"
          }
        ]
      },
      "locations": [
        {
          "column": 34,
          "line": 1
        }
      ],
      "message": "System error",
      "path": [
        "SomePath"
      ]
    }
  ]
}

and calling it as follow:

try {
     var result = await HasuraConnect(url, headers: headers)
         .mutation(document);

     return result;
   }
   on HasuraRequestError catch(e) {
     print(e.extensions?.code);

   }

But always get null. Only what I got is "System error" message. Is there way how to get to extension error messages? Thank you

aliboy-lala avatar Jan 14 '25 13:01 aliboy-lala