From 2111e337c9d6020ebbebbdfb3b7b2b9245ec3e09 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Thu, 19 Apr 2018 18:41:30 +0200 Subject: [PATCH] Fix crash when starting client.js without master --- client.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client.js b/client.js index d87966af..a08eb20e 100644 --- a/client.js +++ b/client.js @@ -632,7 +632,7 @@ function instanceManagement() { hash: modHashes[i].hash, } needle.post(config.masterIP + ":" + config.masterPort + '/api/checkMod', payload, function (err, response, body) { - if(err) throw err // Unable to contact master server! Please check your config.json. + if(err) console.log(new Error("Unable to contact master server! Please check your config.json.")); if(response && body && body == "found") { console.log("master has mod"); } else if (response && body && typeof body == "string") { @@ -643,8 +643,7 @@ function instanceManagement() { // response.body is a string which is a modName.zip var req = request.post("http://"+config.masterIP + ":" + config.masterPort + '/api/uploadMod', function (err, resp, body) { if (err) { - console.log('Error!'); - throw err + console.log(new Error("Unable to contact master server! Please check your config.json.")); } else { console.log('URL: ' + body); }