From 29d2e6b1b37e368c03217a2189dfc83f56d070a4 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Mon, 3 Feb 2020 15:52:37 -0800 Subject: [PATCH] Error.message is read only on some platforms. This causes another Error to be thrown. --- lib/client/udp-tracker.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/client/udp-tracker.js b/lib/client/udp-tracker.js index 2402dbf..d16427d 100644 --- a/lib/client/udp-tracker.js +++ b/lib/client/udp-tracker.js @@ -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) }