graphql-nexus / nexus-plugin-prisma

Deprecated
MIT License
828 stars 118 forks source link

Middlewares, like graphql-shield, are catching global errors #613

Open pantharshit00 opened 4 years ago

pantharshit00 commented 4 years ago

When adding a middleware to either graphql-yoga or to apollo-server, such as graphql-shield, and throwing an error on purpose in one of the resolvers, the middleware catches the Error and the original error is not being thrown/shown.

Reproduction

Originally posted by @BenJeau on https://github.com/prisma/prisma2/issues/1680
luhagel commented 4 years ago

Afaik that is the case specifically with graphql-shield and documented as such.

https://github.com/maticzav/graphql-shield/blob/master/README.md#custom-errors

BenJeau commented 4 years ago

Ohh, I didn't know about that. It's weird that before upgrading to Prisma2, I didn't need to make adjustments to the way I was throwing the custom errors.

By making those changes, it now works as expected, thank you!

luhagel commented 4 years ago

Can we close this, @pantharshit00 ?

pantharshit00 commented 4 years ago

I will leave that to @jasonkuhrt or @Weakky