已合并
feature: [dump] error message modification #662
GuoWenbo创建于 3月5日
feature: [dump] error message modification #662
已合并
共 18 个文件变更+63-253
| @@ -17,7 +17,6 @@ set(ascendDumpSrcList | |||
| 17 | ${ADUMP_ADUMP_DIR}/adump_ascend031/manage/dump_manager.cpp | 17 | ${ADUMP_ADUMP_DIR}/adump_ascend031/manage/dump_manager.cpp |
| 18 | ${ADUMP_ADUMP_DIR}/adump_ascend031/printf/dump_printf.cpp | 18 | ${ADUMP_ADUMP_DIR}/adump_ascend031/printf/dump_printf.cpp |
| 19 | ${ADUMP_ADUMP_DIR}/common/adump_dsmi.cpp | 19 | ${ADUMP_ADUMP_DIR}/common/adump_dsmi.cpp |
| 20 | - ${ADUMP_ADUMP_DIR}/common/adump_error_manager.cpp | ||
| 21 | ${ADUMP_ADUMP_DIR}/common/file.cpp | 20 | ${ADUMP_ADUMP_DIR}/common/file.cpp |
| 22 | ${ADUMP_ADUMP_DIR}/common/json_parser.cpp | 21 | ${ADUMP_ADUMP_DIR}/common/json_parser.cpp |
| 23 | ${ADUMP_ADUMP_DIR}/common/lib_path.cpp | 22 | ${ADUMP_ADUMP_DIR}/common/lib_path.cpp |
| @@ -14,7 +14,6 @@ set(ascendDumpSrcList | |||
| 14 | ${adumpBaseProtoSrcs} | 14 | ${adumpBaseProtoSrcs} |
| 15 | ${adumpHostProtoSrcs} | 15 | ${adumpHostProtoSrcs} |
| 16 | ${ADUMP_ADUMP_DIR}/common/adump_dsmi.cpp | 16 | ${ADUMP_ADUMP_DIR}/common/adump_dsmi.cpp |
| 17 | - ${ADUMP_ADUMP_DIR}/common/adump_error_manager.cpp | ||
| 18 | ${ADUMP_ADUMP_DIR}/common/adump_platform_api/adump_platform_api_device.cpp | 17 | ${ADUMP_ADUMP_DIR}/common/adump_platform_api/adump_platform_api_device.cpp |
| 19 | ${ADUMP_ADUMP_DIR}/common/file.cpp | 18 | ${ADUMP_ADUMP_DIR}/common/file.cpp |
| 20 | ${ADUMP_ADUMP_DIR}/common/json_parser.cpp | 19 | ${ADUMP_ADUMP_DIR}/common/json_parser.cpp |
| @@ -14,7 +14,6 @@ set(ascendDumpSrcList | |||
| 14 | ${adumpBaseProtoSrcs} | 14 | ${adumpBaseProtoSrcs} |
| 15 | ${adumpHostProtoSrcs} | 15 | ${adumpHostProtoSrcs} |
| 16 | ${ADUMP_ADUMP_DIR}/common/adump_dsmi.cpp | 16 | ${ADUMP_ADUMP_DIR}/common/adump_dsmi.cpp |
| 17 | - ${ADUMP_ADUMP_DIR}/common/adump_error_manager.cpp | ||
| 18 | ${ADUMP_ADUMP_DIR}/common/adump_platform_api/adump_platform_api_device.cpp | 17 | ${ADUMP_ADUMP_DIR}/common/adump_platform_api/adump_platform_api_device.cpp |
| 19 | ${ADUMP_ADUMP_DIR}/common/file.cpp | 18 | ${ADUMP_ADUMP_DIR}/common/file.cpp |
| 20 | ${ADUMP_ADUMP_DIR}/common/json_parser.cpp | 19 | ${ADUMP_ADUMP_DIR}/common/json_parser.cpp |
| @@ -14,7 +14,6 @@ set(ascendDumpSrcList | |||
| 14 | ${adumpBaseProtoSrcs} | 14 | ${adumpBaseProtoSrcs} |
| 15 | ${adumpHostProtoSrcs} | 15 | ${adumpHostProtoSrcs} |
| 16 | ${ADUMP_ADUMP_DIR}/common/adump_dsmi.cpp | 16 | ${ADUMP_ADUMP_DIR}/common/adump_dsmi.cpp |
| 17 | - ${ADUMP_ADUMP_DIR}/common/adump_error_manager.cpp | ||
| 18 | ${ADUMP_ADUMP_DIR}/common/adump_platform_api/adump_platform_api.cpp | 17 | ${ADUMP_ADUMP_DIR}/common/adump_platform_api/adump_platform_api.cpp |
| 19 | ${ADUMP_ADUMP_DIR}/common/file.cpp | 18 | ${ADUMP_ADUMP_DIR}/common/file.cpp |
| 20 | ${ADUMP_ADUMP_DIR}/common/json_parser.cpp | 19 | ${ADUMP_ADUMP_DIR}/common/json_parser.cpp |
| @@ -14,7 +14,6 @@ set(ascendDumpSrcList | |||
| 14 | ${adumpBaseProtoSrcs} | 14 | ${adumpBaseProtoSrcs} |
| 15 | ${adumpHostProtoSrcs} | 15 | ${adumpHostProtoSrcs} |
| 16 | ${ADUMP_ADUMP_DIR}/common/adump_dsmi.cpp | 16 | ${ADUMP_ADUMP_DIR}/common/adump_dsmi.cpp |
| 17 | - ${ADUMP_ADUMP_DIR}/common/adump_error_manager.cpp | ||
| 18 | ${ADUMP_ADUMP_DIR}/common/adump_platform_api/close/adump_platform_api.cpp | 17 | ${ADUMP_ADUMP_DIR}/common/adump_platform_api/close/adump_platform_api.cpp |
| 19 | ${ADUMP_ADUMP_DIR}/common/file.cpp | 18 | ${ADUMP_ADUMP_DIR}/common/file.cpp |
| 20 | ${ADUMP_ADUMP_DIR}/common/json_parser.cpp | 19 | ${ADUMP_ADUMP_DIR}/common/json_parser.cpp |
Dsrc/dfx/adump/adump/common/adump_error_manager.cpp+0-37
| @@ -1,37 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | - * Copyright (c) 2025 Huawei Technologies Co., Ltd. | ||
| 3 | - * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| 4 | - * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| 5 | - * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| 6 | - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| 7 | - * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| 8 | - * See LICENSE in the root of the software repository for the full text of the License. | ||
| 9 | - */ | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | -namespace Adx { | ||
| 14 | -void ReportInvalidArgumentError(const std::string param, const std::string value, const std::string reason) | ||
| 15 | -{ | ||
| 16 | - (void)param; | ||
| 17 | - (void)value; | ||
| 18 | - IDE_LOGE("%s", reason.c_str()); | ||
| 19 | - ADUMP_INPUT_ERROR(INVALID_ARGUMENT, std::vector<std::string>({"param", "value", "reason"}), | ||
| 20 | - std::vector<std::string>({param, value, reason})); | ||
| 21 | -} | ||
| 22 | - | ||
| 23 | -void ReportFileOperationError(const std::string &path, const std::string &reason) | ||
| 24 | -{ | ||
| 25 | - (void)path; | ||
| 26 | - IDE_LOGE("%s", reason.c_str()); | ||
| 27 | - ADUMP_INPUT_ERROR(FILE_OPERATION_ERROR, std::vector<std::string>({"path", "reason"}), | ||
| 28 | - std::vector<std::string>({path, reason})); | ||
| 29 | -} | ||
| 30 | - | ||
| 31 | -void ReportConfigParseError(const std::string &reason) | ||
| 32 | -{ | ||
| 33 | - ADUMP_INPUT_ERROR(MEMORY_JSON_PARSE_FAILED, std::vector<std::string>({"reason"}), | ||
| 34 | - std::vector<std::string>({reason})); | ||
| 35 | - (void)reason; | ||
| 36 | -} | ||
| 37 | -} | ||
| @@ -10,36 +10,12 @@ | |||
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | -#include "log/adx_log.h" | 13 | + |
| 14 | +namespace Adx { | ||
| 14 | 15 | ||
| 15 | 16 | ||
| 16 | 17 | ||
| 17 | 18 | ||
| 18 | -namespace Adx { | 19 | +} // namespace Adx |
| 19 | -constexpr const char *const INVALID_ARGUMENT = "EP0001"; | ||
| 20 | -constexpr const char *const FIELD_NOT_FOUND = "Field [%s] not found in config file [%s]."; | ||
| 21 | -constexpr const char *const FIELD_EMPTY = "Field [%s] in config file [%s] is empty."; | ||
| 22 | -constexpr const char *const FIELD_TOO_LONG = "Field [%s] in config file [%s] exceeds the maximum length %d."; | ||
| 23 | -constexpr const char *const FIELD_INVALID_VALUE = "Invalid value [%s] for field [%s] in config file [%s]. Only %s allowed."; | ||
| 24 | -constexpr const char *const FIELD_PATH_INVALID = "Invalid path [%s] for field [%s] in config file [%s]: %s."; | ||
| 25 | -constexpr const char *const FIELD_INVALID_CHARACTERS = "Value [%s] of field [%s] in config file [%s] contains invalid characters."; | ||
| 26 | -constexpr const char *const FIELD_PATH_NO_PERMISSIONS = "Value [%s] of field [%s] in config file [%s] lacks read and write permissions."; | ||
| 27 | 20 | ||
| 28 | -constexpr const char *const FILE_OPERATION_ERROR = "EP0002"; | ||
| 29 | -constexpr const char *const FILE_LENGTH_LT_0 = "File content length cannot be less than 0."; | ||
| 30 | -constexpr const char *const FILE_LENGTH_GT_MAX = "File content length cannot exceed [%d]."; | ||
| 31 | -constexpr const char *const FILE_READ_FAILED = "Failed to read file."; | ||
| 32 | -constexpr const char *const FILE_PATH_INVALID = "Invalid file path: %s"; | ||
| 33 | -constexpr const char *const FILE_STATUS_FAILED = "Failed to get the file status."; | ||
| 34 | -constexpr const char *const FILE_TYPE_INCORRECT = "Incorrect file type."; | ||
| 35 | -constexpr const char *const FILE_JSON_TOO_DEEP = "The levels of \"{\" and \"[\" in the JSON file cannot exceed 10."; | ||
| 36 | -constexpr const char *const FILE_JSON_PARSE_FAILED = "Failed to parse JSON file: %s"; | ||
| 37 | -constexpr const char *const MEMORY_JSON_PARSE_FAILED = "Parse config from memory failed: %s"; | ||
| 38 | - | ||
| 39 | - | ||
| 40 | -void ReportInvalidArgumentError(const std::string param, const std::string value, const std::string reason); | ||
| 41 | - | ||
| 42 | -void ReportFileOperationError(const std::string &path, const std::string &reason); | ||
| 43 | -void ReportConfigParseError(const std::string &reason); | ||
| 44 | -} | ||
| 45 | 21 | ||
| @@ -1233,24 +1233,46 @@ | |||
| 1233 | }, | 1233 | }, |
| 1234 | { | 1234 | { |
| 1235 | "errClass": "DUMP Errors", | 1235 | "errClass": "DUMP Errors", |
| 1236 | - "errTitle": "Invalid_Argument", | 1236 | + "errTitle": "Config_Error", |
| 1237 | "ErrCode": "EP0001", | 1237 | "ErrCode": "EP0001", |
| 1238 | - "ErrMessage": "Value [%s] for [%s] is invalid. Reason: %s.", | 1238 | + "ErrMessage": "The content of configuration item %s in configuration file %s is invalid. Reason: %s.", |
| 1239 | - "Arglist": "value,param,reason", | 1239 | + "Arglist": "item,path,reason", |
| 1240 | "suggestion": { | 1240 | "suggestion": { |
| 1241 | "Possible Cause": "N/A", | 1241 | "Possible Cause": "N/A", |
| 1242 | - "Solution": "Check and modify the configuration according to Reason. For details about the dump usage and restrictions, refer to the official website." | 1242 | + "Solution": "N/A" |
| 1243 | } | 1243 | } |
| 1244 | }, | 1244 | }, |
| 1245 | { | 1245 | { |
| 1246 | "errClass": "DUMP Errors", | 1246 | "errClass": "DUMP Errors", |
| 1247 | - "errTitle": "File_Operation_Error", | 1247 | + "errTitle": "Config_Error", |
| 1248 | "ErrCode": "EP0002", | 1248 | "ErrCode": "EP0002", |
| 1249 | - "ErrMessage": "Abnormal operation on file[%s]. Reason: %s.", | 1249 | + "ErrMessage": "Value %s for configuration item %s in configuration file %s is invalid. Expected value: %s.", |
| 1250 | - "Arglist": "path,reason", | 1250 | + "Arglist": "value,item,path,expected_value", |
| 1251 | "suggestion": { | 1251 | "suggestion": { |
| 1252 | "Possible Cause": "N/A", | 1252 | "Possible Cause": "N/A", |
| 1253 | - "Solution": "Check and modify the configuration according to Reason. For details about the dump usage and restrictions, refer to the official website." | 1253 | + "Solution": "N/A" |
| 1254 | + } | ||
| 1255 | + }, | ||
| 1256 | + { | ||
| 1257 | + "errClass": "DUMP Errors", | ||
| 1258 | + "errTitle": "Config_Error", | ||
| 1259 | + "ErrCode": "EP0003", | ||
| 1260 | + "ErrMessage": "Value %s for configuration item %s in configuration file %s is invalid. Reason: %s.", | ||
| 1261 | + "Arglist": "value,item,path,reason", | ||
| 1262 | + "suggestion": { | ||
| 1263 | + "Possible Cause": "N/A", | ||
| 1264 | + "Solution": "N/A" | ||
| 1265 | + } | ||
| 1266 | + }, | ||
| 1267 | + { | ||
| 1268 | + "errClass": "DUMP Errors", | ||
| 1269 | + "errTitle": "Config_Error_Invalid_Environment_Variable", | ||
| 1270 | + "ErrCode": "WP0001", | ||
| 1271 | + "ErrMessage": "Value %s for environment variable %s is invalid. Reason: %s.", | ||
| 1272 | + "Arglist": "value,env,reason", | ||
| 1273 | + "suggestion": { | ||
| 1274 | + "Possible Cause": "N/A", | ||
| 1275 | + "Solution": "Reset the environment variable by referring to the Environment Variable Reference." | ||
| 1254 | } | 1276 | } |
| 1255 | }, | 1277 | }, |
| 1256 | { | 1278 | { |
| @@ -39,7 +39,6 @@ set(adumpBaseSrcList | |||
| 39 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp | 39 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp |
| 40 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_platform_api/adump_platform_api.cpp | 40 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_platform_api/adump_platform_api.cpp |
| 41 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp | 41 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp |
| 42 | - ${SRC_CODE_ROOT_PATH}/adump/common/adump_error_manager.cpp | ||
| 43 | 42 | ||
| 44 | ${SRC_CODE_ROOT_PATH}/adump/manage/adump_api.cpp | 43 | ${SRC_CODE_ROOT_PATH}/adump/manage/adump_api.cpp |
| 45 | ${SRC_CODE_ROOT_PATH}/adump/manage/adump_api_platform.cpp | 44 | ${SRC_CODE_ROOT_PATH}/adump/manage/adump_api_platform.cpp |
| @@ -175,7 +175,6 @@ TEST_F(DumpConfigConverterUtest, TestConvertCommon) | |||
| 175 | converter = DumpConfigConverter(configData.c_str(), configData.size()); | 175 | converter = DumpConfigConverter(configData.c_str(), configData.size()); |
| 176 | ret = converter.Convert(dumpType, dumpConfig, IsNeedDump, dumpDfxConfig); | 176 | ret = converter.Convert(dumpType, dumpConfig, IsNeedDump, dumpDfxConfig); |
| 177 | EXPECT_EQ(ret, ADUMP_SUCCESS); | 177 | EXPECT_EQ(ret, ADUMP_SUCCESS); |
| 178 | - | ||
| 179 | } | 178 | } |
| 180 | 179 | ||
| 181 | TEST_F(DumpConfigConverterUtest, TestConvertException) | 180 | TEST_F(DumpConfigConverterUtest, TestConvertException) |
| @@ -25,7 +25,6 @@ set(adumpBaseSrc | |||
| 25 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp | 25 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp |
| 26 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_platform_api/close/adump_platform_api.cpp | 26 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_platform_api/close/adump_platform_api.cpp |
| 27 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp | 27 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp |
| 28 | - ${SRC_CODE_ROOT_PATH}/adump/common/adump_error_manager.cpp | ||
| 29 | 28 | ||
| 30 | ${SRC_CODE_ROOT_PATH}/adump/manage/adump_api.cpp | 29 | ${SRC_CODE_ROOT_PATH}/adump/manage/adump_api.cpp |
| 31 | ${SRC_CODE_ROOT_PATH}/adump/impl/dump_datatype.cpp | 30 | ${SRC_CODE_ROOT_PATH}/adump/impl/dump_datatype.cpp |
| @@ -25,7 +25,6 @@ set(adumpBaseDupUtestSrc | |||
| 25 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp | 25 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp |
| 26 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_platform_api/adump_platform_api.cpp | 26 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_platform_api/adump_platform_api.cpp |
| 27 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp | 27 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp |
| 28 | - ${SRC_CODE_ROOT_PATH}/adump/common/adump_error_manager.cpp | ||
| 29 | 28 | ||
| 30 | ${SRC_CODE_ROOT_PATH}/adump/manage/adump_api.cpp | 29 | ${SRC_CODE_ROOT_PATH}/adump/manage/adump_api.cpp |
| 31 | ${SRC_CODE_ROOT_PATH}/adump/impl/dump_datatype.cpp | 30 | ${SRC_CODE_ROOT_PATH}/adump/impl/dump_datatype.cpp |
| @@ -19,7 +19,6 @@ set(adumpBaseTinyUtestSrc | |||
| 19 | ${SRC_CODE_ROOT_PATH}/adump/common/lib_path.cpp | 19 | ${SRC_CODE_ROOT_PATH}/adump/common/lib_path.cpp |
| 20 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp | 20 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp |
| 21 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp | 21 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp |
| 22 | - ${SRC_CODE_ROOT_PATH}/adump/common/adump_error_manager.cpp | ||
| 23 | 22 | ||
| 24 | ${SRC_CODE_ROOT_PATH}/adump/exception/dump_file.cpp | 23 | ${SRC_CODE_ROOT_PATH}/adump/exception/dump_file.cpp |
| 25 | ${SRC_CODE_ROOT_PATH}/adump/exception/kernel_info_collector.cpp | 24 | ${SRC_CODE_ROOT_PATH}/adump/exception/kernel_info_collector.cpp |
| @@ -25,7 +25,6 @@ set(adumpBaseDupUtestSrc | |||
| 25 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp | 25 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp |
| 26 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_platform_api/adump_platform_api.cpp | 26 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_platform_api/adump_platform_api.cpp |
| 27 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp | 27 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp |
| 28 | - ${SRC_CODE_ROOT_PATH}/adump/common/adump_error_manager.cpp | ||
| 29 | 28 | ||
| 30 | ${SRC_CODE_ROOT_PATH}/adump/manage/adump_api.cpp | 29 | ${SRC_CODE_ROOT_PATH}/adump/manage/adump_api.cpp |
| 31 | ${SRC_CODE_ROOT_PATH}/adump/impl/dump_datatype.cpp | 30 | ${SRC_CODE_ROOT_PATH}/adump/impl/dump_datatype.cpp |
| @@ -19,7 +19,6 @@ set(adumpBaseTinyUtestSrc | |||
| 19 | ${SRC_CODE_ROOT_PATH}/adump/common/lib_path.cpp | 19 | ${SRC_CODE_ROOT_PATH}/adump/common/lib_path.cpp |
| 20 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp | 20 | ${SRC_CODE_ROOT_PATH}/adump/common/adump_dsmi.cpp |
| 21 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp | 21 | ${SRC_CODE_ROOT_PATH}/adump/common/json_parser.cpp |
| 22 | - ${SRC_CODE_ROOT_PATH}/adump/common/adump_error_manager.cpp | ||
| 23 | 22 | ||
| 24 | ${SRC_CODE_ROOT_PATH}/adump/exception/dump_file.cpp | 23 | ${SRC_CODE_ROOT_PATH}/adump/exception/dump_file.cpp |
| 25 | ${SRC_CODE_ROOT_PATH}/adump/exception/kernel_info_collector.cpp | 24 | ${SRC_CODE_ROOT_PATH}/adump/exception/kernel_info_collector.cpp |