1 /* 2 * Copyright (c) 2023 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 GRD_ERROR_H 17 #define GRD_ERROR_H 18 19 #include "grd_type_export.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif // __cplusplus 24 25 // Error category 26 #define GRD_OK 0 27 28 // Error category 29 #define GRD_NOT_SUPPORT (-1000) 30 #define GRD_OVER_LIMIT (-2000) 31 #define GRD_INVALID_ARGS (-3000) 32 #define GRD_SYSTEM_ERR (-4000) 33 #define GRD_FAILED_FILE_OPERATION (-5000) 34 #define GRD_INVALID_FILE_FORMAT (-6000) 35 #define GRD_INNER_ERR (-8000) 36 #define GRD_RESOURCE_BUSY (-9000) 37 38 #define GRD_NO_DATA (-11000) 39 #define GRD_FAILED_MEMORY_ALLOCATE (-13000) 40 #define GRD_FAILED_MEMORY_RELEASE (-14000) 41 #define GRD_DATA_CONFLICT (-16000) 42 #define GRD_NOT_AVAILABLE (-19000) 43 #define GRD_INVALID_FORMAT (-37000) 44 #define GRD_REBUILD_DATABASE (-38000) 45 46 // not support 47 #define GRD_JSON_OPERATION_NOT_SUPPORT (-5001001) 48 49 // Exceed limit 50 #define GRD_JSON_LEN_LIMIT (-5002001) 51 52 // Invalid parameter 53 #define GRD_FIELD_TYPE_NOT_MATCH (-5003001) 54 #define GRD_LARGE_JSON_NEST (-5003002) 55 #define GRD_INVALID_JSON_TYPE (-5003003) 56 #define GRD_INVALID_CONFIG_VALUE (-5003004) 57 #define GRD_INVALID_OPERATOR (-5003005) 58 #define GRD_INVALID_PROJECTION_FIELD (-5003006) 59 #define GRD_INVALID_PROJECTION_VALUE (-5003007) 60 #define GRD_ARRAY_INDEX_NOT_FOUND (-5003008) 61 62 // System err 63 #define GRD_JSON_LIB_HANDLE_FAILED (-5004001) 64 65 // no data 66 #define GRD_COLLECTION_NOT_FOUND (-5011001) 67 #define GRD_RECORD_NOT_FOUND (-5011002) 68 #define GRD_DB_NOT_FOUND (-11003) 69 #define GRD_FIELD_NOT_FOUND (-5011004) 70 71 // data conflicted 72 #define GRD_COLLECTION_CONFLICT (-5016001) 73 #define GRD_KEY_CONFLICT (-5016002) 74 #define GRD_FIELD_TYPE_CONFLICT (-5016003) 75 76 // Cursor or ResultSet not available 77 #define GRD_RESULT_SET_NOT_AVAILABLE (-5019001) 78 79 // Invalid format 80 #define GRD_INVALID_JSON_FORMAT (-5037001) 81 #define GRD_INVALID_KEY_FORMAT (-5037002) 82 #define GRD_INVALID_COLLECTION_NAME (-5037003) 83 #ifdef __cplusplus 84 } 85 #endif // __cplusplus 86 #endif // GRD_ERROR_H