Trying to disable explicit message on input validation errors. When I request a field that does not exist (i.e age) i get:
{
"data": null,
"errors": [{
"path": null,
"locations": [
{
"line": 1,
"column": 129,
"sourceName": null
}
],
"message": "Validation error of type FieldUndefined: Field 'age' in type 'Patient' is undefined @ 'path/age'"
}]}
I want to override the error to show a custom error message:
{
"data": null,
"errors": [
{
"message": "invalid fields"
}
]}
sample of my schema with custom SystemError (does not work):
type Patient {
id: Int!
firstName: String
lastName: String
}
type Query {
patient(id: Int!): Patient
errors: [SystemError]
}
type SystemError {
id: Int!
message: String
}
schema {
query: Query
}
You can try to use a middleware, f.e.
middy(some googled appsync middleware), https://github.com/bboure/middy-appsync#error-handlingTo limit error info you can try (not tested) to use something like this: