-
I looked through the other discussions, couldn't find a solution. I am trying to set up a plugin to catch all exceptions and return the appropriate errors like so: export const errorPlugin = plugin({
name: 'ErrorPlugin',
onCreateFieldResolver() {
return async (root, args, ctx, info, next) => {
try {
return next(root, args, ctx, info);
} catch (err) {
console.log('it never gets here even if I throw in the resolver :('); // HERE
if (err instanceof ApolloError) {
throw err;
}
// TODO: sentry
throw new ApolloError('internal server error');
}
};
},
}); Anyone know why it never gets to the catch block? I suspect nexus/schema is doing its own try catch around the resolvers. Or maybe I'm using plugins incorrectly |
Beta Was this translation helpful? Give feedback.
Answered by
nahtnam
Jul 26, 2020
Replies: 1 comment
-
Silly me... Was missing |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
nahtnam
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Silly me... Was missing
await
inside thetry
block