tizen beta release
[framework/web/wrt-installer.git] / src / commons / wrt_error.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * This file contains the declaration of the error codes of Widget.
18  *
19  * @file    wrt_error.h
20  * @author  MaQuan (jason.ma@samsung.com)
21  * @version 0.7
22  * @brief   This file contains the declaration of the error codes of Widget.
23  */
24
25 #ifndef _WRT_ERROR_H_
26 #define _WRT_ERROR_H_
27
28 #ifndef WRT_ERROR_MASKL8
29 #define WRT_ERROR_MASKL8    0xFF
30 #endif
31
32 #ifndef WRT_SET_IDENT
33 #define WRT_SET_IDENT(X)    (X & WRT_ERROR_MASKL8)
34 #endif
35
36 #ifndef WRT_ERROR_SET
37 #define WRT_ERROR_SET(X)    ((X & WRT_ERROR_MASKL8) << 8)
38 #endif
39
40 #define WRT_MID_ERRCODE        0x10000 + WRT_SET_IDENT(5)
41
42 /*typedef */ enum
43 {
44     WRT_GENERAL_ERRCODE = WRT_MID_ERRCODE + WRT_SET_IDENT(0),
45     WRT_CONFIG_ERRCODE = WRT_MID_ERRCODE + WRT_SET_IDENT(1),
46     WRT_DOMAIN_ERRCODE = WRT_MID_ERRCODE + WRT_SET_IDENT(2),
47     WRT_JS_EXT_ERRCODE = WRT_MID_ERRCODE + WRT_SET_IDENT(3),
48     WRT_WM_ERRCODE = WRT_MID_ERRCODE + WRT_SET_IDENT(4),
49     WRT_PLUGIN_ERRCODE = WRT_MID_ERRCODE + WRT_SET_IDENT(5),
50     //_ACE support
51     WRT_SAI_ERRCODE = WRT_MID_ERRCODE + WRT_SET_IDENT(6)
52 };
53
54 /**
55  * WRT error code description
56  *
57  * @ WRT_SUCCESS
58  *    There is no error with WRT operations.
59  *
60  * @ WRT_ERR_UNKNOW
61  *    An unknow error happened to WRT.
62  *
63  * @ WRT_ERR_INVALID_ARG
64  *    Invalid arguments are passed into WRT functions.
65  *
66  * @ WRT_ERR_OUT_MEMORY
67  *    No memory space available for WRT.
68  *
69  * @ WRT_ERR_NO_DISK_SPACE
70  *    There is no disk space for widget applications.
71  *
72  *
73  *
74  *
75  */
76 enum WrtError
77 {
78     /* General errors */
79     WRT_SUCCESS = WRT_GENERAL_ERRCODE + WRT_ERROR_SET(0x01),
80     WRT_ERR_UNKNOWN = WRT_GENERAL_ERRCODE + WRT_ERROR_SET(0x02),
81     WRT_ERR_INVALID_ARG = WRT_GENERAL_ERRCODE + WRT_ERROR_SET(0x03),
82     WRT_ERR_OUT_OF_MEMORY = WRT_GENERAL_ERRCODE + WRT_ERROR_SET(0x04),
83     WRT_ERR_NO_DISK_SPACE = WRT_GENERAL_ERRCODE + WRT_ERROR_SET(0x05),
84
85     /* Configuration */
86     WRT_CONF_ERR_GCONF_FAILURE = WRT_CONFIG_ERRCODE + WRT_ERROR_SET(0x01),
87     WRT_CONF_ERR_OBJ_MISSING = WRT_CONFIG_ERRCODE + WRT_ERROR_SET(0x02),
88     WRT_CONF_ERR_OBJ_EXIST = WRT_CONFIG_ERRCODE + WRT_ERROR_SET(0x03),
89     WRT_CONF_ERR_START_FILE_MISSING = WRT_CONFIG_ERRCODE + WRT_ERROR_SET(0x04),
90     WRT_CONF_ERR_EMDB_FAILURE = WRT_CONFIG_ERRCODE + WRT_ERROR_SET(0x05),
91     WRT_CONF_ERR_EMDB_NO_RECORD = WRT_CONFIG_ERRCODE + WRT_ERROR_SET(0x06),
92
93     /* Domain */
94     WRT_DOMAIN_ERR_CREATE_JS_RT = WRT_DOMAIN_ERRCODE + WRT_ERROR_SET(0x01),
95     WRT_DOMAIN_ERR_MSG_QUEUE = WRT_DOMAIN_ERRCODE + WRT_ERROR_SET(0x02),
96
97     /* Widget manager*/
98     WRT_WM_ERR_NOT_INSTALLED = WRT_WM_ERRCODE + WRT_ERROR_SET(0x01),
99     WRT_WM_ERR_HIGH_VER_INSTALLED = WRT_WM_ERRCODE + WRT_ERROR_SET(0x02),
100     WRT_WM_ERR_LOW_VER_INSTALLED = WRT_WM_ERRCODE + WRT_ERROR_SET(0x03),
101     WRT_WM_ERR_INVALID_ARCHIVE = WRT_WM_ERRCODE + WRT_ERROR_SET(0x04),
102     WRT_WM_ERR_INVALID_CERTIFICATION = WRT_WM_ERRCODE + WRT_ERROR_SET(0x05),
103     WRT_WM_ERR_NULL_CERTIFICATION = WRT_WM_ERRCODE + WRT_ERROR_SET(0x06),
104     WRT_WM_ERR_INSTALLATION_CANCEL = WRT_WM_ERRCODE + WRT_ERROR_SET(0x07),
105     WRT_WM_ERR_ALREADY_INSTALLED = WRT_WM_ERRCODE + WRT_ERROR_SET(0x08),
106     WRT_WM_ERR_INSTALL_FAILED = WRT_WM_ERRCODE + WRT_ERROR_SET(0x09),
107     WRT_WM_ERR_DELETE_BY_SERVER = WRT_WM_ERRCODE + WRT_ERROR_SET(0x0a),
108     WRT_WM_ERR_DEINSTALLATION_CANCEL = WRT_WM_ERRCODE + WRT_ERROR_SET(0x0b),
109     WRT_WM_ERR_INCORRECT_UPDATE_INFO = WRT_WM_ERRCODE + WRT_ERROR_SET(0x0c),
110     WRT_WM_ERR_UNREG_FAILED = WRT_WM_ERRCODE + WRT_ERROR_SET(0x0d),
111     WRT_WM_ERR_REMOVE_FILES_FAILED = WRT_WM_ERRCODE + WRT_ERROR_SET(0x0e),
112     WRT_WM_ERR_ALREADY_LATEST = WRT_WM_ERRCODE + WRT_ERROR_SET(0x0f),
113     WRT_WM_ERR_UPDATE_CANCEL = WRT_WM_ERRCODE + WRT_ERROR_SET(0x10),
114     WRT_WM_ERR_IS_FACTORY_WIDGET = WRT_WM_ERRCODE + WRT_ERROR_SET(0x11),
115     WRT_WM_ERR_INVALID_APP_ID = WRT_WM_ERRCODE + WRT_ERROR_SET(0x12),
116
117     /* Access Control Manager */
118     WRT_SAI_ERR_INIT_ACE_FAILED = WRT_SAI_ERRCODE + WRT_ERROR_SET(0x01)
119 };
120
121 namespace CommonError {
122 enum Type
123 {
124     WrtSuccess,                ///< Success
125
126     HandleNotFound,         ///< Widget handle was not found
127     AlreadyRunning,         ///< Widget is already running
128     AlreadyStopped,         ///< Widget is already stopped
129     InvalidLanguage,        ///< Widget is invalid in current locales
130     StillAuthorizing,       ///< Widget is still autorizing and has not yet finished it
131     EarlyKilled,            ///< Widget was early killed during launch
132     AccessDenied,           ///< Access denied from ACE
133     CertificateRevoked,     ///< Some certificate was revoked.
134                             ///  Widget is not allowed to run.
135
136     Unknown                 ///< Temporary error. Try to not use this.
137 };
138 }
139 #endif /* _WRT_ERROR_H_ */
140