• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 FRAMEWORKS_ANI_SRC_INCLUDE_ANI_ERROR_H
17 #define FRAMEWORKS_ANI_SRC_INCLUDE_ANI_ERROR_H
18 
19 #include <string>
20 #include "ani.h"
21 #include "datashare_result_set.h"
22 
23 namespace OHOS {
24 namespace Media {
25 #define EXPORT __attribute__ ((visibility ("default")))
26 struct AniError {
27     int32_t error = 0;
28     std::string apiName;
29     EXPORT void SetApiName(const std::string &Name);
30     void SaveError(const std::shared_ptr<DataShare::DataShareResultSet> &resultSet);
31     EXPORT void SaveError(int32_t ret);
32     EXPORT void HandleError(ani_env *env, ani_object &errorObj);
33     EXPORT static void ThrowError(ani_env *env, int32_t err, const std::string &errMsg = "");
34     EXPORT static void ThrowError(ani_env *env, int32_t err, const char *func, int32_t line,
35         const std::string &errMsg = "");
36 };
37 } // namespace Media
38 } // namespace OHOS
39 #endif  // FRAMEWORKS_ANI_SRC_INCLUDE_ANI_ERROR_H