set default error messages for mutations in Hasura

313 views Asked by At

I am using the Hasura console. If I get an error, I see a message like this:

{
  "errors": [
    {
      "extensions": {
        "path": "$.selectionSet.insert_one.args.object",
        "code": "constraint-violation"
      },
      "message": "Uniqueness violation. duplicate key value violates unique constraint \"vehicle_number_plate_key\""
    }
  ]
}

Is there any way that I can use the console to set a custom error message? I couldn't find any such option on the console.

1

There are 1 answers

0
kazam On

Not sure if there is a way to customize the error messages that are generated by Hasura.

However, if this is to be consumed by a single frontend client, you can just let the frontend client define its own error messages.

This is also practical to support multi-language error messages if the need arises.