Hasura: friendlier error messages on `statement_timeout`
Currently, for public instances which can't use an allow-list (to allow other developers to write their own queries for hackathons and smaller projects, like https://demo.chaingraph.cash) the most definitive way to prevent excessive resource usage by expensive queries is to run Hasura under a Postgres user with a reasonable statement_timeout.
When a query fails due to statement_timeout, the Postgres error message reads something like canceling statement due to statement timeout.
Unfortunately, the error message ultimately returned by Hasura is not very helpful:
{
"errors": [
{
"extensions": {
"path": "$",
"code": "unexpected"
},
"message": "database query error"
}
]
}
It would be much nicer if Hasura returned a more meaningful error message, e.g.:
{
"errors": [
{
"message": "Request cancelled due to excessive resource usage. Please limit your query and try again."
}
]
}
This issue will remain open to track the feature request on Hasura's issue tracker: https://github.com/hasura/graphql-engine/issues/7839