Hello,
I have been unable to pass a custom error message from the coprocessor to the response of the router. The coprocessor is running in the RouterRequest stage. decodedRequestBody
is the complete incoming request object
I have attempted to pass it as a string
decodedRequestBody["Control"] = {break: 400}
//you can specify a string value for body. If you do, the router returns an error response with that string as the error's message.
//https://www.apollographql.com/docs/graphos/routing/customization/coprocessor#terminating-a-client-request
decodedRequestBody["body"] = message
Response from coprocessor
{
"Control": {
"break": 400
},
"body": "Client must pass ...",
.....
which returns from the router
{
"errors": [
{
"message": "Invalid GraphQL request",
"extensions": {
"details": "failed to deserialize the request body into JSON: expected value at line 1 column 1",
"code": "INVALID_GRAPHQL_REQUEST"
}
}
]
}
I have also tried passing a json string
decodedRequestBody["Control"] = {break: 400}
decodedRequestBody["body"] = `{"errors": [{"message": "` + message + `"}]}`
Response from coprocessor
{
"Control": {
"break": 400
},
"body": "{\"errors\": [{\"message\": \"Client must pass ...\"}]}",
.....
Returning from router:
{
"errors": [
{
"message": "Must provide query string.",
"extensions": {
"code": "MISSING_QUERY_STRING"
}
}
]
}