From 3ff5e630ca2aa0fb73e4e858b7f35c5d1e91b44d Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Fri, 3 Apr 2020 14:57:49 +0200 Subject: [PATCH] Warn on unhandled Factorio ipc Send warning to console if an ipc message is received but there were no handlers registered to handle it. --- lib/factorio/server.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/factorio/server.js b/lib/factorio/server.js index 028ee217..d2934d9f 100644 --- a/lib/factorio/server.js +++ b/lib/factorio/server.js @@ -505,7 +505,9 @@ class FactorioServer extends events.EventEmitter { throw new Error(`Unknown IPC type '${type}'`); } - this.emit(`ipc-${channel}`, content); + if (!this.emit(`ipc-${channel}`, content)) { + console.warn(`Warning: Unhandled ipc-${channel}`, content); + } } _handleOutput(line, source) {