Apollo Error
Custom payload in Apollo GraphQL server.
Usage
Install via npm
npm install apollo-error
Bind with Apollo Server
Showing example for Express below.
;;;; ; const app = ; app; app;
Throw ApolloError
throw message /* your custom payload here */ foo: 'bar' ...;
Response handling
You can access the custom payload in your response handler like the following.
ifresponseerrors const myErrorMessage = responseerrors0message; const myErrorExtras = responseerrors0data;