Skip to content

Commit

Permalink
#35 Add sentry error reporting to apollo
Browse files Browse the repository at this point in the history
  • Loading branch information
danielemery committed Sep 28, 2023
1 parent e2361d9 commit ede1f00
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ async function initialise() {
resolvers,
csrfPrevention: true,
plugins: [ApolloServerPluginDrainHttpServer({ httpServer })],
formatError(formattedError, error) {
if (formattedError.extensions?.code === 'INTERNAL_SERVER_ERROR') {
Sentry.captureException(error);
}
return formattedError;
},
});

Sentry.init({
Expand Down

0 comments on commit ede1f00

Please sign in to comment.