sync with tizen_2.0
[platform/framework/native/appfw.git] / src / base / FBase_Exception.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FBaseExceptionInternal.cpp
20  * @brief               This is the implementation file for Exception.
21  */
22
23 #include "FBase_Exception.h"
24
25 const char* ExceptionStrings[] =
26 {
27         "Success",
28         "OutOfMemoryError",
29         "IndexOutOfBoundsException",
30
31         "InstanceAlreadyExistsException",
32
33         "IllegalArgumentException",
34         "IllegalAccessException",
35         "IllegalStateException",
36
37         "NullPointerException",
38
39         "UndefinedTypeException",
40         "NotImplementedException",
41
42         "ParseException",
43         "DataFormatException",
44         "SystemException",
45         "IOException",
46         "NetworkConnectionException",
47         "ArithmeticException",
48         "TimeoutException",
49         "UnknownException",
50         "UnknownError",
51         "EndofGeneralExcpetion",
52
53         // base exception
54         "CreateFailedException",
55
56         "NoSuchInstanceException",
57         "ComponentNotFoundException",
58         "MethodNotFoundException",
59         "InterfaceNotFoundException",
60         "SectionNotFoundException",
61         "EntryNotFoundException",
62         "ValueNotAssignedException",
63         "InvalidDocumentException",
64
65         "FileLongPathException",
66         "FileInvalidPathException",
67         "FileNotFoundException",
68         "FileAlreadyExistException",
69         "FileEndOfFileException",
70         "FilePermissionException",
71         "FileNotEmptyDirException",
72         "FileOpenLimitExceededException",
73         "FileCorruptedException",
74         "FileVolumeFullException",
75         "FileQuotaExceededException",
76         "FileDeviceFailureException",
77         "FileVolumeNotMountedException",
78         "FileMediaEjectedException",
79         "FilePanicException",
80
81         "KeyNotFoundException",
82         "ActorNotFoundException",
83         "ContextModelNotFoundException",
84         "ListenerNotFoundException",
85         "ChannelNotFoundException",
86
87         "IpcProxyMethodException",
88         "IpcStubMethodException",
89         "StubIsAlreadyRunning",
90         "NoStubFound",
91         "NoProxyFound",
92         "NoSuchProxyConnected",
93         "NoIpcListenerFound",
94         "NoIpcEventFound",
95         "IpcUserDataAlreadyExist",
96         "IpcStubNoUserDataFound",
97         "IpcAddListenerDenied",
98         "IpcEventNotFound",
99         "IpcInterfaceNotFound",
100         "IpcNoListenerFound",
101         "IPCAllIpcCallSlotIsUsing",
102         "IPCNoAvailabeID",
103         "IpcMsgQueueNotFound",
104
105         "DatabaseErrorException",
106         "DatabaseTooBigException",
107         "DatabaseBusyException",
108         "DatabaseEndOfResultSet",
109         "DatabaseNotChangedException",
110         "AppIDAlreadyExist",
111         "AppIDIsNotExist",
112
113         "EncodingFailedException",
114         "DecodingFailedException",
115
116         "EndofBaseException",
117
118
119
120
121         // service exception
122         "ServiceAlreadyRegisteredException",
123         "XmlParsingException",
124         "ServiceNotRegisteredException",
125         "EventSourceNotRegisteredException",
126         "ServerException",
127         "InvalidPeerCredentialException",
128         "UnSupportedProtocolException",
129         "UnSupportedEncodingException",
130         "DomException",
131         "InvalidMessageTypeException",
132         "NetworkAbortException",
133         "NetworkAlreadyAbortedException",
134         "NetworkAbortFailedException",
135         "EndofServiceException",
136
137         // group exception
138         "GroupNotFoundException",
139         "UserNotFoundException",
140         "ServiceNotFoundException",
141         "AttributeNotFoundException",
142         "DuplicateAttributeException",
143         "AlreadyJoinedGroupException",
144         "NotJoinedGroupException",
145         "AlreadyInvitedException",
146         "InvitationNotFoundException",
147         "MaxMemberExceededException",
148         "NotPermittedGenderException",
149         "CategoryNotFoundException",
150         "DuplicateJoinRequestException",
151         "JoinProhibitedException",
152         "DuplicateGroupNameException",
153         "EndofGroupException",
154
155
156         // security exception
157         "SignFailedException",
158         "InvalidSignatureException",
159         "VersionNotMatchException",
160
161         "AmbiguousCredentialException",
162         "CredentialNotFoundException",
163
164         "AlreadyUserRegisteredException",
165         "UserNotRegisteredException",
166         "AlreadyUserAuthenticatedException",
167         "UserNotAuthenticatedException",
168         "UserIDNotMatchedException",
169
170         "EncryptFailedException",
171         "DecryptFailedException",
172         "HMACFailedException",
173         "RandomByteFailedException",
174         "HashFailedException",
175         "PasswordNotMatchedException",
176
177         "PrivilegeDeniedException",
178
179         "EndofSecurityException,",
180
181
182         // storage exception
183         "PathNotFoundException",
184         "PathAlreadyExistException",
185
186         "EndofStorageException",
187
188         // context exception
189         "ContextModelCountMaxException",
190         "DataNotFoundException",
191         "SQLException",
192         "InvalidSensorCIDException",
193         "ObjectDataNotFoundException",
194         "IllegalConditionObjectException",
195         "IllegalConditionChannelException",
196         "InvalidModelDefinitionException",
197         "NoSuchTableException",
198         "ServiceUnavailableException",
199         "ContextStorageNotFoundException",
200         "ContextStorageExistException",
201         "ContextTypeNotFoundException",
202         "ContextStorageNotOpenedException",
203         "ContextStorageNotClosedException",
204         "ContextElementNotFoundException",
205         "CursorNotDeletedException",
206
207         "CanNotLaunchServerException",
208         "CanNotAllocResourceException",
209         "TooManyOnGoingSessionsException",
210         "CanNotDecodeException",
211         "InvalidEncodeTypeException",
212         "NeedCoProcessorException",
213         "CoProcessingException",
214         "CaughtBrokenInternalsException",
215         "CaughtIncompleteCodeException",
216         "NotCQPEnabledDeviceNameException",
217         "CanNotFindEntityException",
218         "ExceedMaximumBufferLimitException",
219         "RemoteExecuteQueryException",
220
221         "InvalidHandleException",
222         "SessionAlreadyInProgressException",
223         "ExceedMaximumHandleCountException",
224         "TooManyOnGoingTasksException",
225         "InvalidCqlStatementException",
226         "TypeMissMatchingException",
227         "AlreadyRegisteredException",
228         "LoadingCsr256FailedException",
229         "EndofResultSetException",
230         "NotSupportedOperationException",
231         "HandleClosedByOtherThreadException",
232         "RequestCanceledByOtherThreadException",
233         "QueryExecutionNotCompletedException",
234         "InvalidCursorObjectException",
235         "TriggerFiredException",
236         "InvalidCursorPositionException",
237         "EmptyCursorObjectException",
238         "OpenedHandleExistException",
239
240         // context importer exception
241         "DBConnectionFailedException",
242         "SQLExecutionFailedException",
243
244         //Rfid exceptions
245         "TagNotFoundException",
246         "TagLoginFailedException",
247         "TagErrorException",
248         "NoDataOnTagException",
249         "IncompatibleTagException",
250         "TagLockedException",
251
252         "EndofContextException",
253
254         // Second life exceptions
255         "NotLoggedInException",
256         "BalanceNotReceivedException",
257         "NotEnoughBalanceException",
258         "OverflowException",
259         "OutOfBoundaryException",
260         "UnsupportedException",
261         "TeleportInProgressException",
262         "MovementInProgressException",
263         "RequestAlreadyInProgressException",
264         "NoChangeException",
265         "InventoryDataNotReceivedException",
266         "MaximumGroupJoinLimitException",
267
268         "EndofSecondlifeException",
269
270 //      "CacheFullException",
271
272         // location services exception
273         "LocationException",
274         "SecurityException",
275         "LandmarkException",
276         "LandmarkMaxNumberExceededException",
277         "LocationServiceException",
278         "LocationServiceInterruptedException",
279
280         "EndofLocationException",
281
282         "CacheFullException",
283
284         "EndofEMSClientException",
285
286         // Device Exception
287         "OSPSyncProfileNotExistException",
288         "InvalidDeviceInformationException",
289         "InvalidSequenceNumberException",
290         "NoLocalDeviceInformationException",
291         "NoLocalSequenceNumberException",
292         "NoSuchDeviceException",
293         "NoSuchOperationException",
294         "NoDeviceResponseListenerException",
295         "RequiredParameterMissing",
296
297         // Device Synchronization
298         "DataSyncNetworkFailureException",
299         "NoActiveChangeLogException",
300         "NoActiveSyncSessionException",
301         "NoSuchAppDataFolderException",
302         "NoSuchSyncSessionException",
303         "SyncInProgressException",
304         "DeviceOperationFailureException",
305         "DBReadFailureException",
306         "NoSuchChangeObjectException",
307
308         // Device Management Exception
309         "NoSuchApplicationIDException",
310         "NoSuchURIException",
311         "NoSuchScheduleException",
312         "NoSuchNodeException",
313         "NoSuchNodeDataException",
314         "InvalidParameterException",
315
316         "EndofDeviceException",
317
318         "UndefinedException" // for exception handling
319 };
320
321
322 /**
323  * Returns a string representation of the specified exception. It is useful when printing out a caught exception.
324  *
325  * @param[in]   e       exception to query.
326  */
327 const char*
328 ExceptionToString(Exception e)
329 {
330         if (e < 0 || e > UNDEFINED_EXCEPTION)
331         {
332                 e = UNDEFINED_EXCEPTION;
333         }
334         return ExceptionStrings[EXCEPTION_INDEX(e)];
335 }