Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On methods that return a stream - onError throws an error when the stream ends #86

Open
secondl1ght opened this issue Jul 20, 2023 · 1 comment

Comments

@secondl1ght
Copy link
Contributor

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.

@jamaljsr
Copy link
Member

This is something we faced as well but were fine with checking for EOF at the app level. However, I do agree it would be better to handle this gracefully in lnc-web as long as it won't break anything. Thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants