chr15m / chr15m/bugout

Prevent app crash on destroy()

Open
#72 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
637
Forks
58
PR merge metrics
No merged PRs in 30d

Description

```bash
/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 ](https://github.com/webtorrent/webtorrent/blob/master/index.js#L407)

We need to prevent it , maybe we can include this line inside a try catch :
https://github.com/chr15m/bugout/blob/62ddbc85365fc508eddcb8d5ab3a35b3ed000712/index.js#L159

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..

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.