Error.message is read only on some platforms.

This causes another Error to be thrown.
This commit is contained in:
Koushik Dutta 2020-02-03 15:52:37 -08:00 committed by GitHub
parent 7ec91ebecc
commit 29d2e6b1b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,7 +130,11 @@ class UDPTracker extends Tracker {
cleanup()
if (self.destroyed) return
if (err.message) err.message += ` (${self.announceUrl})`
try {
// Error.message is readonly on some platforms.
if (err.message) err.message += ` (${self.announceUrl})`
} catch (ignored) {
}
// errors will often happen if a tracker is offline, so don't treat it as fatal
self.client.emit('warning', err)
}