mirror of
https://github.com/appium/appium.git
synced 2026-04-26 05:18:53 -05:00
Catch SyntaxError exception and log nice error message
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user