已合并
fix: [dump] error code for parse json #1284
fix: [dump] error code for parse json #1284
已合并
GuoWenbo创建于 3月28日
2 个文件变更+9-9
Msrc/dfx/adump/adump/impl/dump_config_converter.cpp+4-4
@@ -331,7 +331,7 @@ bool DumpConfigConverter::CheckDumpPath() const
331 std::string errorMsg;331 std::string errorMsg;
332 if (!FileUtils::IsPathHasPermission(dumpPath, errorMsg)) {332 if (!FileUtils::IsPathHasPermission(dumpPath, errorMsg)) {
333 IDE_LOGE("%s", errorMsg.c_str());333 IDE_LOGE("%s", errorMsg.c_str());
334 std::string errReason = "The value is a path without read and write permissions";334 std::string errReason = (errno == EACCES) ? "The value is a path without read and write permissions" : "The value is an invalid path";
335 ADUMP_INPUT_ERROR("EP0003", std::vector<std::string>({"value", "item", "path", "reason"}),335 ADUMP_INPUT_ERROR("EP0003", std::vector<std::string>({"value", "item", "path", "reason"}),
336 std::vector<std::string>({dumpPath, ADUMP_DUMP_PATH, configPath_, errReason}));336 std::vector<std::string>({dumpPath, ADUMP_DUMP_PATH, configPath_, errReason}));
337 return false;337 return false;
@@ -836,6 +836,9 @@ int32_t DumpConfigConverter::Convert(DumpType &dumpType, DumpConfig &dumpConfig,
836 );836 );
837 } catch (const std::exception &e) {837 } catch (const std::exception &e) {
838 IDE_LOGE("convert exception: %s", e.what());838 IDE_LOGE("convert exception: %s", e.what());
839 std::string errReason(e.what());
840 ADUMP_INPUT_ERROR("EP0004", std::vector<std::string>({"path", "reason"}),
841 std::vector<std::string>({configPath_, errReason}));
839 return ADUMP_FAILED;842 return ADUMP_FAILED;
840 }843 }
841 return ADUMP_SUCCESS;844 return ADUMP_SUCCESS;
@@ -905,9 +908,6 @@ void DumpConfigConverter::LoadDumpEnvVariables(DumpEnvVariable &dumpEnvVariable)
905 std::string optionStr = TransOptionsToStr(envDumpScenes);908 std::string optionStr = TransOptionsToStr(envDumpScenes);
906 IDE_LOGW("Value[%s] of Env[ASCEND_DUMP_SCENE] is invalid, it must be %s",909 IDE_LOGW("Value[%s] of Env[ASCEND_DUMP_SCENE] is invalid, it must be %s",
907 envAscendDumpScene.c_str(), optionStr.c_str());910 envAscendDumpScene.c_str(), optionStr.c_str());
908 std::string warnReason = StrUtils::Format("The dump scene must be selected form[%s]", optionStr.c_str());
909 ADUMP_INPUT_ERROR("WP0001", std::vector<std::string>({"value", "env", "reason"}),
910 std::vector<std::string>({envAscendDumpScene, ADUMP_ENV_ASCEND_DUMP_SCENE, warnReason}));
911 }911 }
912 }912 }
913 913 
Msrc/dfx/error_manager/error_code.json+5-5
@@ -1266,13 +1266,13 @@
1266 },1266 },
1267 {1267 {
1268 "errClass": "DUMP Errors",1268 "errClass": "DUMP Errors",
1269 "errTitle": "Config_Error_Invalid_Environment_Variable",1269 "errTitle": "File_Operation_Error_Parse",
1270 "ErrCode": "WP0001",1270 "ErrCode": "EP0004",
1271 "ErrMessage": "Value %s for environment variable %s is invalid. Reason: %s.",1271 "ErrMessage": "Failed to parse file %s. Reason: %s.",
1272 "Arglist": "value,env,reason",1272 "Arglist": "path,reason",
1273 "suggestion": {1273 "suggestion": {
1274 "Possible Cause": "N/A",1274 "Possible Cause": "N/A",
1275 "Solution": "Reset the environment variable by referring to the Environment Variable Reference."1275 "Solution": "N/A"
1276 }1276 }
1277 },1277 },
1278 {1278 {