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

Prevent app crash on destroy() #72

Open
Kos-M opened this issue May 7, 2024 · 1 comment
Open

Prevent app crash on destroy() #72

Kos-M opened this issue May 7, 2024 · 1 comment

Comments

@Kos-M
Copy link
Contributor

Kos-M commented May 7, 2024

/app/sa/node_modules/webtorrent/index.js:424
    if (!torrent) throw new Error(`No torrent with id ${torrentId}`)
                  ^

Error: No torrent with id [object Object]
    at WebTorrent.remove (/app/sa/node_modules/webtorrent/index.js:424:25)
    at WebTorrent.remove (/app/sa/node_modules/webtorrent/index.js:420:49)
    at Bugout.destroy (/app/sa/node_modules/bugout/index.js:159:13)
    at Connector.healthCheckRealaytorConnection (/app/sa/src/connector.js:200:17)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

Seems webtorrent thows an error when we call remove() with a wrong id.
(for reference Line 407

We need to prevent it , maybe we can include this line inside a try catch :

bugout/index.js

Line 159 in 62ddbc8

this.wt.remove(this.torrent, cb);

I faced above error , in a reconection mechanism i have implemented in my app , so im calling bugout destroy() in an interval..
It works as expected , except this crash..

@chr15m
Copy link
Owner

chr15m commented May 8, 2024

Sounds good, send a PR if you want. I can merge it but I don't want to push anything to npm without basic browser testing and I don't really have time to do this myself.

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