interledgerjs / ilp-protocol-stream

Moved to monorepo in interledgerjs/interledgerjs
https://github.com/interledger/rfcs/blob/master/0029-stream/0029-stream.md
32 stars 15 forks source link

fix uncaught rejection #173

Closed sentientwaffle closed 2 years ago

sentientwaffle commented 2 years ago

Fixes a bug that Uphold ran into. An uncaught rejection was bubbling up from end().

I was unable to reproduce locally or as a test case. My best guess is that the error is triggered by a concurrent startSendLoop (i.e. the exchange rate probe) that triggers an error event, while simultaneously a ConnectionClose frame is being handled. The error is caught by the .once('error', reject) in the end method, which bubbles it up.

Also includes a fix for an unrelated sendData error.