Request scoped factories exception filters not caught by GqlExceptionFilter
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 432
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 26
Description
I'm submitting a...
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When throwing an exception inside of a request scoped factory, the exception will not be caught by exception filters. This might be related to the issue I filled in the nestjs/nest repository (https://github.com/nestjs/nest/issues/5173) - where exception filters thrown in request scoped factories will not terminate the response.
Expected behavior
When throwing an exception inside of a request scoped factory, exception filters will catch the exception.
Minimal reproduction of the problem with instructions
https://github.com/egodsk/nestjs-graphql-exception-filter
Start the app npm run start:dev, and hit the graphql endpoint POST localhost:3000/graphql with the following body's:
{
test
}
and
{
test2
}
The test query will result in an error which will not be caught by the exception filter, however the test2 query will correctly we caught by the exception filter.
What is the motivation / use case for changing the behavior?
I would like to be able to throw request scoped exceptions inside of factories and then catch them with Exception Filters to convert them to ApolloError syntax.
Environment
Nest version: 7.4.2
For Tooling issues:
- Node version: v.12.18.2
- Platform: Mac
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked minimal reproduction repository and run npm run start:dev. Compare the test and test2 GraphQL queries, tracing how exceptions from the request-scoped factory reach the GqlExceptionFilter; done means both queries are caught and converted to the expected ApolloError syntax.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, node.js, typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100