arobson / rabbot

Deprecated: Please see https://github.com/Foo-Foo-MQ/foo-foo-mq
MIT License
277 stars 129 forks source link

Cannot catch queue.unsubscribe() #115

Open astanciu opened 6 years ago

astanciu commented 6 years ago

Maybe I'm missing something but I don't see a way to catch the rejection thrown here: https://github.com/arobson/rabbot/blob/a5ccc4dd9652298e8f7e11cf2e08cb4ddb12bf22/src/queueFsm.js#L198

because during an unsubscription, as here: https://github.com/arobson/rabbot/blob/a5ccc4dd9652298e8f7e11cf2e08cb4ddb12bf22/src/index.js#L395

it doesn't return the rejection..

arobson commented 6 years ago

@astanciu - I apologize, due to the pretty significant refactoring for v2, those line numbers don't make sense. If you let me know what it is you want to accomplish or find the corresponding lines, I can take another look.

astanciu commented 6 years ago

I updated the original msg above with URLs that point to the commit before v2.

It appears that you're returning an error object, rather than throwing it, which isn't handled at all in the 2nd link (index.js)

astanciu commented 6 years ago

Here's the current lines: This line here returns a promise (rejected), which is completely lost/unhandled. https://github.com/arobson/rabbot/blob/master/src/index.js#L529

The code here should maybe throw ? https://github.com/arobson/rabbot/blob/master/src/queueFsm.js#L241