1 /* 2 * Copyright (c) 2021 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 #ifndef ROSEN_COMMON_GRAPHIC_ERROR_H 17 #define ROSEN_COMMON_GRAPHIC_ERROR_H 18 19 #ifdef __cplusplus 20 #include <cstdint> 21 #include <cstring> 22 #include <map> 23 #include <string> 24 25 namespace OHOS { 26 namespace Rosen { 27 #endif 28 29 // Graphic Rosen Error, number just find fast, it may change 30 enum RosenError : int32_t { 31 ROSEN_ERROR_OK = 0, 32 33 // 400 BAD_REQUEST 34 ROSEN_ERROR_INVALID_ARGUMENTS = 40001000, 35 36 // 403 FORBIDDEN 37 ROSEN_ERROR_NO_PERMISSION = 40301000, 38 39 // 404 NOT_FOUND 40 ROSEN_ERROR_CONNOT_CONNECT_SAMGR = 40401000, 41 ROSEN_ERROR_CONNOT_CONNECT_SERVER = 40402000, 42 ROSEN_ERROR_CONNOT_CONNECT_WESTON = 40403000, 43 44 // 406 NOT_ACCEPTABLE 45 ROSEN_ERROR_NO_BUFFER = 40601000, 46 ROSEN_ERROR_NO_ENTRY = 40602000, 47 ROSEN_ERROR_OUT_OF_RANGE = 40603000, 48 49 // 412 PRECONDITION_FAILED 50 ROSEN_ERROR_INVALID_OPERATING = 41201000, 51 ROSEN_ERROR_NO_CONSUMER = 41202000, 52 ROSEN_ERROR_NOT_INIT = 41203000, 53 ROSEN_ERROR_TYPE_ERROR = 41204000, 54 ROSEN_ERROR_DESTROYED_OBJECT = 41205000, 55 56 // 500 INTERNAL ERROR 57 ROSEN_ERROR_API_FAILED = 50001000, 58 ROSEN_ERROR_INTERNAL = 50002000, 59 ROSEN_ERROR_NO_MEM = 50003000, 60 ROSEN_ERROR_PROXY_NOT_INCLUDE = 50004000, 61 ROSEN_ERROR_SERVER_ERROR = 50005000, 62 63 // 501 NOT_IMPLEMENTED 64 ROSEN_ERROR_NOT_IMPLEMENT = 50101000, 65 ROSEN_ERROR_NOT_SUPPORT = 50102000, 66 67 // 504 GATEWAY ERROR 68 ROSEN_ERROR_BINDER = 50401000, 69 }; 70 71 #ifdef __cplusplus 72 static const std::map<RosenError, std::string> RosenErrorStrs = { 73 {ROSEN_ERROR_OK, "<200 ok>"}, 74 {ROSEN_ERROR_INVALID_ARGUMENTS, "<400 invalid arguments>"}, 75 {ROSEN_ERROR_NO_PERMISSION, "<403 no permission>"}, 76 {ROSEN_ERROR_CONNOT_CONNECT_SAMGR, "<404 connot connect to samgr>"}, 77 {ROSEN_ERROR_CONNOT_CONNECT_SERVER, "<404 connot connect to server>"}, 78 {ROSEN_ERROR_CONNOT_CONNECT_WESTON, "<404 connot connect to weston>"}, 79 {ROSEN_ERROR_NO_BUFFER, "<406 no buffer>"}, 80 {ROSEN_ERROR_NO_ENTRY, "<406 no entry>"}, 81 {ROSEN_ERROR_OUT_OF_RANGE, "<406 out of range>"}, 82 {ROSEN_ERROR_INVALID_OPERATING, "<412 invalid operating>"}, 83 {ROSEN_ERROR_NO_CONSUMER, "<412 no consumer>"}, 84 {ROSEN_ERROR_NOT_INIT, "<412 not init>"}, 85 {ROSEN_ERROR_TYPE_ERROR, "<412 type error>"}, 86 {ROSEN_ERROR_API_FAILED, "<500 api call failed>"}, 87 {ROSEN_ERROR_INTERNAL, "<500 internal error>"}, 88 {ROSEN_ERROR_NO_MEM, "<500 no memory>"}, 89 {ROSEN_ERROR_PROXY_NOT_INCLUDE, "<500 proxy not include>"}, 90 {ROSEN_ERROR_SERVER_ERROR, "<500 server occur error>"}, 91 {ROSEN_ERROR_NOT_IMPLEMENT, "<501 not implement>"}, 92 {ROSEN_ERROR_NOT_SUPPORT, "<501 not support>"}, 93 {ROSEN_ERROR_BINDER, "<504 binder occur error>"}, 94 }; 95 96 // backstore error 97 enum BSError : int32_t { 98 BS_ERROR_OK = ROSEN_ERROR_OK, 99 BS_ERROR_ERROR = ROSEN_ERROR_INTERNAL, 100 BS_ERROR_BINDER_ERROR = ROSEN_ERROR_BINDER, 101 BS_ERROR_NULLPTR = ROSEN_ERROR_INVALID_ARGUMENTS, 102 BS_ERROR_NO_ENTRY = ROSEN_ERROR_NO_ENTRY, 103 BS_ERROR_INVALID_OPERATING = ROSEN_ERROR_INVALID_OPERATING, 104 BS_ERROR_NO_BUFFER = ROSEN_ERROR_NO_BUFFER, 105 BS_ERROR_INVALID_PARAM = ROSEN_ERROR_INVALID_ARGUMENTS, 106 BS_ERROR_INIT = ROSEN_ERROR_INTERNAL, 107 BS_ERROR_NOMEM = ROSEN_ERROR_NO_MEM, 108 BS_ERROR_API_FAILED = ROSEN_ERROR_API_FAILED, 109 BS_ERROR_NOT_SUPPORT = ROSEN_ERROR_NOT_SUPPORT, 110 BS_ERROR_OUT_OF_RANGE = ROSEN_ERROR_OUT_OF_RANGE, 111 BS_ERROR_TYPE_ERROR = ROSEN_ERROR_TYPE_ERROR, 112 BS_ERROR_NO_CONSUMER = ROSEN_ERROR_NO_CONSUMER, 113 }; 114 } // namespace Rosen 115 } // namespace OHOS 116 #endif // __cplusplus 117 118 #endif // INTERFACES_INNERKITS_COMMON_GRAPHIC_COMMON_H 119