Hi! I was hoping on using a plugin to capture a query and return something else in its stead, in this case, an error, while receiving that at the other end of the plugin with willSendResponse
, example:
{
async requestDidStart() {
return {
async responseForOperation({ context }) {
return {
errors: [new GraphQLError('Everything exploded')],
data: null,
};
},
async willSendResponse({ context, errors }) {
console.log(errors, '<------ errors should be here?');
},
};
},
},
In this example, while the graphql server result is as expected, errors
in willSendResponse
is always undefined
. Throwing the error also produces the expected result but willSendResponse
does not trigger at all.
I have a testing environment here: Apollo Server Plugin Problem - StackBlitz
use the following query:
query {
hello { message }
}