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_INSUFFICIENT_SPACE (-7000) 36 #define GRD_INNER_ERR (-8000) 37 #define GRD_RESOURCE_BUSY (-9000) 38 39 #define GRD_NO_DATA (-11000) 40 #define GRD_FAILED_MEMORY_ALLOCATE (-13000) 41 #define GRD_FAILED_MEMORY_RELEASE (-14000) 42 #define GRD_DATA_CONFLICT (-16000) 43 #define GRD_NOT_AVAILABLE (-19000) 44 #define GRD_INVALID_FORMAT (-37000) 45 #define GRD_REBUILD_DATABASE (-38000) 46 #define GRD_TIME_OUT (-39000) 47 #define GRD_DB_INSTANCE_ABNORMAL (-40000) 48 #define GRD_DISK_SPACE_FULL (-41000) 49 #define GRD_CRC_CHECK_DISABLED (-42000) 50 #define GRD_PERMISSION_DENIED (-43000) 51 #define GRD_DATA_CORRUPTED (-45000) 52 #define GRD_DB_BUSY (-46000) 53 54 // not support 55 #define GRD_JSON_OPERATION_NOT_SUPPORT (-5001001) 56 57 // Exceed limit 58 #define GRD_JSON_LEN_LIMIT (-5002001) 59 60 // Invalid parameter 61 #define GRD_FIELD_TYPE_NOT_MATCH (-5003001) 62 #define GRD_LARGE_JSON_NEST (-5003002) 63 #define GRD_INVALID_JSON_TYPE (-5003003) 64 #define GRD_INVALID_CONFIG_VALUE (-5003004) 65 #define GRD_INVALID_OPERATOR (-5003005) 66 #define GRD_INVALID_PROJECTION_FIELD (-5003006) 67 #define GRD_INVALID_PROJECTION_VALUE (-5003007) 68 #define GRD_ARRAY_INDEX_NOT_FOUND (-5003008) 69 70 // System err 71 #define GRD_JSON_LIB_HANDLE_FAILED (-5004001) 72 73 // no data 74 #define GRD_COLLECTION_NOT_FOUND (-5011001) 75 #define GRD_RECORD_NOT_FOUND (-5011002) 76 #define GRD_FIELD_NOT_FOUND (-5011004) 77 78 // data conflicted 79 #define GRD_COLLECTION_CONFLICT (-5016001) 80 #define GRD_KEY_CONFLICT (-5016002) 81 #define GRD_FIELD_TYPE_CONFLICT (-5016003) 82 83 // data exception 84 #define GRD_DATA_EXCEPTION (-5017001) 85 86 // Cursor or ResultSet not available 87 #define GRD_RESULT_SET_NOT_AVAILABLE (-5019001) 88 89 // Invalid format 90 #define GRD_INVALID_JSON_FORMAT (-5037001) 91 #define GRD_INVALID_KEY_FORMAT (-5037002) 92 #define GRD_INVALID_COLLECTION_NAME (-5037003) 93 #ifdef __cplusplus 94 } 95 #endif // __cplusplus 96 #endif // GRD_ERROR_H