Prevent tcp socket errors from dumping straight to console (2.0.7)

This commit is contained in:
mmorrison 2019-01-20 03:52:40 -06:00
parent 05619469b7
commit 9a536b160e
3 changed files with 7 additions and 1 deletions

View file

@ -429,6 +429,9 @@ as well: `--debug`, `--pretty`, `--socketTimeout 5000`, etc.
Changelog Changelog
--- ---
### 2.0.7
* Prevent tcp socket errors from dumping straight to console
### 2.0.6 ### 2.0.6
* Added support for host domains requiring Punycode encoding (special characters) * Added support for host domains requiring Punycode encoding (special characters)

View file

@ -11,7 +11,7 @@
], ],
"main": "lib/index.js", "main": "lib/index.js",
"author": "Michael Morrison", "author": "Michael Morrison",
"version": "2.0.6", "version": "2.0.7",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/sonicsnes/node-gamedig.git" "url": "https://github.com/sonicsnes/node-gamedig.git"

View file

@ -179,6 +179,9 @@ class Core extends EventEmitter {
socket = net.connect(port,address); socket = net.connect(port,address);
socket.setNoDelay(true); socket.setNoDelay(true);
// Prevent unhandled 'error' events from dumping straight to console
socket.on('error', () => {});
this.debugLog(log => { this.debugLog(log => {
this.debugLog(address+':'+port+" TCP Connecting"); this.debugLog(address+':'+port+" TCP Connecting");
const writeHook = socket.write; const writeHook = socket.write;