• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "aot_compiler_error_utils.h"
17 #include <map>
18 
19 namespace OHOS::ArkCompiler {
20 namespace {
21 const std::map<int32_t, std::string> ERR_MSG_MAP = {
22     { ERR_OK,                             "success" },
23     { ERR_AOT_COMPILER_PARAM_FAILED,      "aot compiler arguments error" },
24     { ERR_AOT_COMPILER_CONNECT_FAILED,    "connect failed" },
25     { ERR_AOT_COMPILER_CALL_FAILED,       "call failed" },
26     { ERR_AOT_COMPILER_SIGNATURE_FAILED,  "local code sign failed" },
27     { ERR_AOT_COMPILER_SIGNATURE_DISABLE, "local code sign disable" },
28     { ERR_OK_NO_AOT_FILE,                 "no aot file save" },
29     { ERR_AOT_COMPILER_STOP_FAILED,       "aot compiler stop error" }
30 };
31 } // namespace
32 
GetErrorMessage(int32_t errCode)33 std::string AotCompilerErrorUtil::GetErrorMessage(int32_t errCode)
34 {
35     std::string errMsg;
36     auto iter = ERR_MSG_MAP.find(errCode);
37     if (iter != ERR_MSG_MAP.end()) {
38         errMsg = iter->second;
39     } else {
40         errMsg = "invalid errCode";
41     }
42     return errMsg;
43 }
44 } // namespace OHOS::ArkCompiler