RTCErrorEvent when destroying peer
- Dominant language
- JavaScript
- Stars
- 7.8k
- Forks
- 983
- PR merge metrics
- No merged PRs in 30d
Description
**What version of this package are you using?**
`9.8.0` (via `simple-signal-client 3.0.0`)
**What operating system, Node.js, and npm version?**
* is this relevant? it's on the client. (macOS `10.15.7`, node `14.10.1`, npm `6.14.8`, firefox `85.0a1`, chrome `86.0.4240.183`)
**What happened?**
When trying to destroy a peer, an error is thrown.
I get the error below that points me to [_destroy](https://github.com/feross/simple-peer/blob/d62864ab0262cfc6aaf46ae92ebb6bf2c6dc8e4d/index.js#L406)
```
events.js:151 Uncaught Error: Uncaught, unspecified "error" event. ([object RTCErrorEvent])
at Peer.emit (events.js:151)
at Peer._destroy (index.js:460)
at Peer.destroy (index.js:403)
at RTCDataChannel._channel.onerror (index.js:495)
```
maybe this is an example?
```
if (peer._channel === null) {
console.log('need to delete this peer!', peer)
peer.destroy()
console.error('caught rtcError', rtcError)
} else {
peer.send(_encode(msg));
}
```
**What did you expect to happen?**
Get no error
**Are you willing to submit a pull request to fix this bug?**
If I can figure it out!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.