From 1d3385f9943d4c9b9f7e3e5d5b73a8d8e29b1c88 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Fri, 12 Mar 2021 16:42:09 +0800 Subject: [PATCH] modify geloge and report errmsg --- ge/omm/csa_interact.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ge/omm/csa_interact.cc b/ge/omm/csa_interact.cc index 1b33ddbd..98e23a5b 100644 --- a/ge/omm/csa_interact.cc +++ b/ge/omm/csa_interact.cc @@ -79,6 +79,7 @@ Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, ErrorModule error_module) { if (!is_init_) { GELOGE(INTERNAL_ERROR, "CsaInteract has not init, can't WriteJobState"); + REPORT_INNER_ERROR("E19999", "CsaInteract has not init, can't WriteJobState"); return INTERNAL_ERROR; } if ((curr_state_ == JOBSTATE_FAILED) || (curr_state_ == JOBSTATE_KILLED)) { @@ -107,7 +108,9 @@ Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, content = content_json.dump(); } catch (const nlohmann::json::exception &e) { + GELOGE(INTERNAL_ERROR, "construct json object failed."); GELOGE(INTERNAL_ERROR, "build jobstate content json string failed, exception:%s job_state:%u", e.what(), job_state); + REPORT_INNER_ERROR("E19999", "construct json object failed. exception:%s job_state:%u", e.what(), job_state); return INTERNAL_ERROR; } @@ -169,6 +172,7 @@ void CsaInteract::WriteInternalErrorCode() { Status CsaInteract::WriteHcomDetection(const std::string &content) { if (!is_init_) { GELOGE(INTERNAL_ERROR, "CsaInteract has not init, can't WriteJobState"); + REPORT_INNER_ERROR("E19999", "WriteHcomDetection failed. CsaInteract has not init, can't WriteJobState"); return INTERNAL_ERROR; } @@ -192,28 +196,38 @@ Status CsaInteract::WriteFile(const std::string &file_name, const std::string &c int32_t fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); if (fd == EN_ERROR) { if (MakePath(file_name) != SUCCESS) { + GELOGE(INTERNAL_ERROR, "MakePath failed."); GELOGE(INTERNAL_ERROR, "csainteract create file path fail, errno is %d", errno); + REPORT_CALL_ERROR("E19999", "MakePath failed. create file path fail, errno is %d", errno); return INTERNAL_ERROR; } fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); if (fd == EN_ERROR) { + GELOGE(INTERNAL_ERROR, "mmOpen2 failed."); GELOGE(INTERNAL_ERROR, "open file fail, errno is %d", errno); + REPORT_CALL_ERROR("E19999", "mmOpen2 failed. open file fail, errno is %d", errno); return INTERNAL_ERROR; } } mmSsize_t ret = mmWrite(fd, reinterpret_cast(const_cast(content.c_str())), content.length()); if (ret == EN_ERROR) { + GELOGE(INTERNAL_ERROR, "mmWrite failed."); GELOGE(INTERNAL_ERROR, "write file fail, errno is %d", errno); + REPORT_CALL_ERROR("E19999", "mmWrite failed. write file fail, errno is %d", errno); ret = mmClose(fd); if (ret == EN_ERROR) { + GELOGE(INTERNAL_ERROR, "mmClose failed."); GELOGE(INTERNAL_ERROR, "close file fail, error is %d", errno); + REPORT_CALL_ERROR("E19999", "mmClose failed. close file fail, error is %d", errno); } return INTERNAL_ERROR; } ret = mmClose(fd); if (ret == EN_ERROR) { + GELOGE(INTERNAL_ERROR, "mmClose failed."); GELOGE(INTERNAL_ERROR, "close file fail, error is %d", errno); + REPORT_CALL_ERROR("E19999", "mmClose failed. close file fail, error is %d", errno); return INTERNAL_ERROR; } @@ -242,7 +256,9 @@ Status CsaInteract::MakePath(const std::string &file_name) { std::string pre_path = file_path.substr(0, found + 1); if (mmAccess(pre_path.c_str()) != EN_OK) { if (mmMkdir(pre_path.c_str(), M_IRWXU) != EN_OK) { + GELOGE(INTERNAL_ERROR, "mmMkdir failed."); GELOGE(INTERNAL_ERROR, "csainteract mkdir fail, errno is %d", errno); + REPORT_CALL_ERROR("E19999", "mmMkdir failed. mkdir fail, errno is %d", errno); return INTERNAL_ERROR; } }