|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * CException - Generic exception handler for db manager. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 @released |
|
23 @internalTechnology |
|
24 */ |
|
25 |
|
26 #include "exception.h" |
|
27 |
|
28 std::string CException::EmptyMessage = "No Message available"; |
|
29 |
|
30 /** |
|
31 Constructs the exception handler object through setting the message. |
|
32 This is to be used when only message is available for the exception |
|
33 to be raised. |
|
34 |
|
35 @param aMessage exception details in readable text format. |
|
36 */ |
|
37 DllExport CException::CException(const std::string& aMessage) |
|
38 : iMessage(aMessage), |
|
39 iCode(ExceptionCodes::EUnintializedCode) |
|
40 {} |
|
41 |
|
42 /** |
|
43 Constructs the exception handler object through setting the error code. |
|
44 This is to be used when only an error code is available for the exception |
|
45 to be raised. |
|
46 |
|
47 @param aCode error code of the exception. |
|
48 */ |
|
49 DllExport CException::CException(int aCode) |
|
50 : iMessage(CException::EmptyMessage) , |
|
51 iCode(aCode) |
|
52 {} |
|
53 |
|
54 /** |
|
55 Constructs the exception handler object through setting the message and |
|
56 error code. This is to be used when both the message and the error code |
|
57 is available for the exception to be raised. |
|
58 |
|
59 @param aMessage exception details in readable text format. |
|
60 @param aCode error code of the exception. |
|
61 */ |
|
62 DllExport CException::CException(const std::string& aMessage, int aCode) |
|
63 : iMessage(aMessage), |
|
64 iCode(aCode) |
|
65 {} |
|
66 |
|
67 /** |
|
68 Constructs the exception handler object through setting the message and |
|
69 error code. This is to be used when both the message and the error code |
|
70 is available for the exception to be raised. |
|
71 |
|
72 @param aMessage exception details in readable text format. |
|
73 @param aCode error code of the exception. |
|
74 */ |
|
75 DllExport CException::CException(const char* aMessage, int aCode) |
|
76 : iMessage(aMessage), |
|
77 iCode(aCode) |
|
78 {} |
|
79 |
|
80 /** |
|
81 Retrieves the message details of an exception handler. |
|
82 */ |
|
83 DllExport const std::string& CException::GetMessageA() const |
|
84 { |
|
85 return iMessage; |
|
86 } |
|
87 |
|
88 /** |
|
89 Retrieves the error code of an exception handler. |
|
90 */ |
|
91 DllExport int CException::GetCode() const |
|
92 { |
|
93 return iCode; |
|
94 } |