graphql-subscriptions icon indicating copy to clipboard operation
graphql-subscriptions copied to clipboard

withFilter with rejected promise is considered False, hides errors

Open gabor opened this issue 6 years ago • 0 comments

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.

gabor avatar Jul 10 '18 11:07 gabor