Error handling with Q

So I have the following code

Q.fcall(foo(input))
.then(
  () ->
    # do stuff
)
.fail(
  # this never gets called
)

foo = (input) ->
  throw new Error('catch me!')

And I get the following error: Uncaught Error: catch me!. By docs In the call .failerrors must be detected caused by foo- Am I doing something wrong?

+4
source share
1 answer

It should be Q.fcall(foo, input)

+3
source

Source: https://habr.com/ru/post/1539280/


All Articles