graphql-subscriptions
graphql-subscriptions copied to clipboard
withFilter with rejected promise is considered False, hides errors
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:
- resolved to True
- resolved to False
- 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.