From b7e9301797b5413638b24427ab8e3611ed39d4a6 Mon Sep 17 00:00:00 2001 From: Chalith Desaman Date: Tue, 16 Mar 2021 18:40:18 +0530 Subject: [PATCH] Formatting the hp config validation error message (#271) * Formatting config validation error * Camel case typo in js client lib * Changed error message --- examples/js_client/hp-client-lib.js | 2 +- src/conf.cpp | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/js_client/hp-client-lib.js b/examples/js_client/hp-client-lib.js index 6b514371..9f7ffeee 100644 --- a/examples/js_client/hp-client-lib.js +++ b/examples/js_client/hp-client-lib.js @@ -504,7 +504,7 @@ roundTime: m.round_time, contractExecutionEnabled: m.contract_execution_enabled, readRequestsEnabled: m.read_requests_enabled, - isFull_history_node: m.is_full_history_node, + isFullHistoryNode: m.is_full_history_node, currentUnl: m.current_unl, peers: m.peers }); diff --git a/src/conf.cpp b/src/conf.cpp index 73939e67..c3fbe800 100644 --- a/src/conf.cpp +++ b/src/conf.cpp @@ -340,7 +340,7 @@ namespace conf startup_role = cfg.node.role = ROLE::VALIDATOR; else { - std::cerr << "Invalid mode. 'observer' or 'validator' expected.\n"; + std::cerr << "Invalid role. 'observer' or 'validator' expected.\n"; return -1; } @@ -354,6 +354,7 @@ namespace conf return -1; } + jpath = "node.history_config"; cfg.node.history_config.max_primary_shards = node["history_config"]["max_primary_shards"].as(); cfg.node.history_config.max_blob_shards = node["history_config"]["max_blob_shards"].as(); @@ -769,10 +770,7 @@ namespace conf void print_missing_field_error(std::string_view jpath, const std::exception &e) { // Extract field name from jsoncons exception message. - std::string msg = e.what(); - msg.erase(0, msg.find("'") + 1); - const std::string field = msg.substr(0, msg.find("'")); - std::cerr << "Required config field '" << jpath << "." << field << "' missing at " << ctx.config_file << std::endl; + std::cerr << "Config validation error: " << e.what() << " in '" << jpath << "' section at " << ctx.config_file << std::endl; } /**