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