1 /*
2  * Copyright (c) 2022 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 #include "object_error.h"
17 
18 namespace OHOS {
19 namespace ObjectStore {
GetMessage()20 std::string ParametersType::GetMessage()
21 {
22     return "Parameter error. The type of '" + name + "' must be '" + wantType + "'.";
23 }
24 
GetCode()25 int ParametersType::GetCode()
26 {
27     return EXCEPTION_PARAMETER_CHECK;
28 }
29 
GetMessage()30 std::string ParametersNum::GetMessage()
31 {
32     return "Parameter error. Need " + wantNum + " parameters!";
33 }
34 
GetCode()35 int ParametersNum::GetCode()
36 {
37     return EXCEPTION_PARAMETER_CHECK;
38 }
39 
GetMessage()40 std::string PermissionError::GetMessage()
41 {
42     return "Permission verification failed. An attempt was made to join session forbidden by permission: "
43            "ohos.permission.DISTRIBUTED_DATASYNC.";
44 }
45 
GetCode()46 int DatabaseError::GetCode()
47 {
48     return EXCEPTION_DB_EXIST;
49 }
50 
GetMessage()51 std::string DatabaseError::GetMessage()
52 {
53     return "Failed to create the in-memory database.";
54 }
55 
GetCode()56 int PermissionError::GetCode()
57 {
58     return EXCEPTION_NO_PERMISSION;
59 }
60 
GetMessage()61 std::string InnerError::GetMessage()
62 {
63     return "";
64 }
65 
GetCode()66 int InnerError::GetCode()
67 {
68     return EXCEPTION_INNER;
69 }
70 
GetMessage()71 std::string DeviceNotSupportedError::GetMessage()
72 {
73     return "Capability not supported.";
74 }
75 
GetCode()76 int DeviceNotSupportedError::GetCode()
77 {
78     return EXCEPTION_DEVICE_NOT_SUPPORT;
79 }
80 } // namespace ObjectStore
81 } // namespace OHOS