lightninglabs / lightninglabs/lnc-web
On methods that return a stream - `onError` throws an error when the stream ends
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 55
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
I discovered this when using the `sendPaymentV2` method. I use the `onMessage` and `onError` streams that are returned. When the stream ends (the payment being sent has the `'SUCCEEDED'` status), `onError` throws an error called `EOF`. I am assuming this means 'End-of-file' https://en.wikipedia.org/wiki/End-of-file.
I am able to escape this by checking for `if (error.message === 'EOF')` but it would be nice if this didn't happen. I don't think a stream being terminated should be treated as an error.
In situations where you want to alert the user of an error ex. with an Alert or Toast, you will always have to escape this normal ending of stream condition.
I have only tested this with `sendPaymentV2` so it may only be an issue with this method, but I am guessing it may affect other ones as well.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the sendPaymentV2 entry point and trace how its onMessage and onError streams handle normal completion. Compare the behavior with other stream-returning methods; done means a completed payment stream no longer emits EOF through onError while genuine stream errors still do.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100