apollographql / apollographql/graphql-subscriptions
withFilter with rejected promise is considered False, hides errors
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 129
- PR merge metrics
- No merged PRs in 30d
Description
you can use a (promise-boolean)-returning function as your filter-function in withFilter.
considering a promise-boolean, the returned value can be three things:
1. resolved to True
2. resolved to False
3. rejected
the code currently considers case [3] as "False".
the problem happens when you use an `async` function as the filter-function, because when you have an error in your filter-function and an exception is thrown, you will never find out about it, because it becomes a rejected promise, which is considered simply "False".
it would be nice to somehow better handle this situation, perhaps doing a `console.error` when the promise is rejected, or mention this issue in the documentation, so that the users can put `try-catch` blocks around their with-filter code.
Contributor guide
Research direction
Start at the withFilter implementation and trace how a rejected promise from an async filter function is handled. The issue does not name a file or test, and it leaves the intended behavior unresolved between logging the rejection, documenting it, or changing error propagation; confirm that decision before adding coverage.
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
- Needs clarification
- Newbie friendliness
- 35/100