Line data Source code
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 : #ifndef HCCLV2_EXCEPTION_DEFINITION_H
12 : #define HCCLV2_EXCEPTION_DEFINITION_H
13 :
14 : #include <map>
15 : #include <string>
16 : #include "../types/hccl_result.h"
17 : #include "../utils/enum_factory_legacy.h"
18 :
19 : namespace Hccl {
20 8257 : MAKE_ENUM(
21 : ExceptionType, NULL_PTR_EXCEPTION, INVALID_PARAMS_EXCEPTION, TIMEOUT_EXCEPTION, DRV_API_EXCEPTION,
22 : NETWORK_API_EXCEPTION, RUNTIME_API_EXCEPTION, RESOURCES_NOT_EXIST_EXCEPTION, NOT_SUPPORT_EXCEPTION,
23 : INTERNAL_EXCEPTION, RMA_CONN_EXCEPTION, SOCKET_EXCEPTION, RES_UNPACKAGE_EXCEPTION, HOST_IP_NOT_FOUND_EXCEPTION,
24 : TRACE_API_EXCEPTION, CCU_API_EXCEPTION, SUSPENDING_EXCEPTION)
25 :
26 : class ExceptionInfo {
27 : public:
28 : static std::string GetErrorMsg(const ExceptionType& type);
29 :
30 : static HcclResult GetErrorCode(const ExceptionType& type);
31 :
32 : private:
33 : static std::map<ExceptionType, std::string> errorMsgMap;
34 : static std::map<ExceptionType, HcclResult> errorCodeMap;
35 : };
36 :
37 : } // namespace Hccl
38 :
39 : #endif
|