Merge pull request #1634 from grz0/master

Catch SyntaxError exception and log nice error message
This commit is contained in:
Jonathan Lipps
2013-12-18 15:56:27 -08:00
+7 -2
View File
@@ -13,7 +13,7 @@ exports.registerNode = function (configFile) {
if (data) {
postRequest(data);
} else {
logger.error("No data found in the node configuration file to send to the grid");
logger.error("No data found in the node configuration file to send to the grid");
}
});
};
@@ -31,7 +31,12 @@ function registerToGrid(options_post, jsonObject) {
function postRequest(data) {
//parse json to get hub host and port
var jsonObject = JSON.parse(data);
var jsonObject;
try {
jsonObject = JSON.parse(data);
} catch(e) {
return logger.error("Syntax error in node configuration file: " + e.message);
}
// prepare the header
var post_headers = {
'Content-Type' : 'application/json'