diff --git a/src/config_parser.cpp b/src/config_parser.cpp index 44a945b..3d3993e 100644 --- a/src/config_parser.cpp +++ b/src/config_parser.cpp @@ -74,7 +74,7 @@ uint32_t ConfigParser::Init() } if (!root_ || !cJSON_IsObject(root_)) { - cerr << "Error: ConfigParser root node not obeject." << NEW_LINE_PATH << filePath_ << endl; + cerr << "Error: JSON file parsing failed, please check the JSON file." << NEW_LINE_PATH << filePath_ << endl; return RESTOOL_ERROR; } diff --git a/src/id_defined_parser.cpp b/src/id_defined_parser.cpp index 19880de..9ae5cd5 100755 --- a/src/id_defined_parser.cpp +++ b/src/id_defined_parser.cpp @@ -85,17 +85,20 @@ uint32_t IdDefinedParser::Init(const string &filePath, bool isSystem) } if (!root_ || !cJSON_IsObject(root_)) { - cerr << "Error: IdDefinedParser root node not obeject." << NEW_LINE_PATH << filePath << endl; + cerr << "Error: JSON file parsing failed, please check the JSON file."; + cerr << NEW_LINE_PATH << filePath << endl; return RESTOOL_ERROR; } cJSON *recordNode = cJSON_GetObjectItem(root_, "record"); if (!recordNode || !cJSON_IsArray(recordNode)) { - cerr << "Error: id_defined.json record not array." << endl; + cerr << "Error: 'record' node is not an array, please check the JSON file."; + cerr << NEW_LINE_PATH << filePath << endl; return RESTOOL_ERROR; } if (cJSON_GetArraySize(recordNode) == 0) { - cerr << "Error: id_defined.json 'record' empty." << endl; + cerr << "Error: 'record' node is empty, please check the JSON file."; + cerr << NEW_LINE_PATH << filePath << endl; return RESTOOL_ERROR; } int32_t startSysId = 0; diff --git a/src/json_compiler.cpp b/src/json_compiler.cpp index d03303c..ddca073 100644 --- a/src/json_compiler.cpp +++ b/src/json_compiler.cpp @@ -54,19 +54,22 @@ uint32_t JsonCompiler::CompileSingleFile(const FileInfo &fileInfo) return RESTOOL_ERROR; } if (!root_ || !cJSON_IsObject(root_)) { - cerr << "Error: JsonCompiler root node not obeject." << NEW_LINE_PATH << fileInfo.filePath << endl; + cerr << "Error: JSON file parsing failed, please check the JSON file."; + cerr << NEW_LINE_PATH << fileInfo.filePath << endl; return RESTOOL_ERROR; } cJSON *item = root_->child; if (cJSON_GetArraySize(root_) != 1) { - cerr << "Error: root node must only one member." << NEW_LINE_PATH << fileInfo.filePath << endl; + cerr << "Error: node of a JSON file can only have one member, please check the JSON file."; + cerr << NEW_LINE_PATH << fileInfo.filePath << endl; return RESTOOL_ERROR; } string tag = item->string; auto ret = g_contentClusterMap.find(tag); if (ret == g_contentClusterMap.end()) { - cerr << "Error: invalid tag name '" << tag << "'." << NEW_LINE_PATH << fileInfo.filePath << endl; + cerr << "Error: invalid tag name '" << tag << "', please check the JSON file."; + cerr << NEW_LINE_PATH << fileInfo.filePath << endl; return RESTOOL_ERROR; } diff --git a/src/reference_parser.cpp b/src/reference_parser.cpp index 517d5dc..5e01d6c 100644 --- a/src/reference_parser.cpp +++ b/src/reference_parser.cpp @@ -144,7 +144,7 @@ bool ReferenceParser::ParseRefJson(const string &from, const string &to) return false; } if (!root_ || !cJSON_IsObject(root_)) { - cerr << "Error: ReferenceParser root node not obeject." << NEW_LINE_PATH << from << endl; + cerr << "Error: JSON file parsing failed, please check the JSON file." << NEW_LINE_PATH << from << endl; return RESTOOL_ERROR; } bool needSave = false; diff --git a/src/resconfig_parser.cpp b/src/resconfig_parser.cpp index 2abdd7e..31c52e8 100644 --- a/src/resconfig_parser.cpp +++ b/src/resconfig_parser.cpp @@ -34,7 +34,7 @@ uint32_t ResConfigParser::Init(const string &filePath, HandleBack callback) return RESTOOL_ERROR; } if (!root_ || !cJSON_IsObject(root_)) { - cerr << "Error: ResConfigParser root node not obeject." << NEW_LINE_PATH << filePath << endl; + cerr << "Error: JSON file parsing failed, please check the JSON file." << NEW_LINE_PATH << filePath << endl; return RESTOOL_ERROR; } if (!callback) {