-
I'm trying to expose the prisma errors with the codes if (error.code === 'P2025' || error.code === 'P2002') {
return error.message;
} I know about throw new GraphQLError('my cool custom message'); which works for me (using yoga). But I don't want to wrap every db call into a try catch block which maps the errors, I would like to do this globally. Something like Error is thrown => My function runs, decides to either throw a GraphQLError or simply return the thrown error => Error gets returned Is something like this possible? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think you are looking for this: https://the-guild.dev/graphql/yoga-server/docs/features/error-masking#customize-error-masking |
Beta Was this translation helpful? Give feedback.
I think you are looking for this: https://the-guild.dev/graphql/yoga-server/docs/features/error-masking#customize-error-masking