Open pantharshit00 opened 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
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!
Can we close this, @pantharshit00 ?
I will leave that to @jasonkuhrt or @Weakky
When adding a middleware to either
graphql-yoga
or toapollo-server
, such asgraphql-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
prisma-nexus
repographql-shield
yarn add graphql-shield
graphql-yoga
middlewares: [shield({})] - with or without any permissions)throw new Error('message')
in one of the resolversthrow new Error('custom error message')
to the first line of the blog query resolver method{ blog(id: 1) {id} }
will raise an error with the message being "Not Authorised!" instead of "custom error message"Originally posted by @BenJeau on https://github.com/prisma/prisma2/issues/1680