Clone
ixen <ixen@copyhandler.com>
committed
on 02 May 15
Removed explicit references to chcore namespace from chcore namespace.
LoggerImprovements + 5 more
src/libchcore/TCoreException.cpp (+4 -4)
6 6 *   it under the terms of the GNU Library General Public License          *
7 7 *   (version 2) as published by the Free Software Foundation;             *
8 8 *                                                                         *
9 9 *   This program is distributed in the hope that it will be useful,       *
10 10 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11 11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12 12 *   GNU General Public License for more details.                          *
13 13 *                                                                         *
14 14 *   You should have received a copy of the GNU Library General Public     *
15 15 *   License along with this program; if not, write to the                 *
16 16 *   Free Software Foundation, Inc.,                                       *
17 17 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18 18 ***************************************************************************/
19 19 #include "stdafx.h"
20 20 #include "TCoreException.h"
21 21 #include <atltrace.h>
22 22
23 23 BEGIN_CHCORE_NAMESPACE
24 24
25 25 // ============================================================================
26   /// chcore::TCoreException::TCoreException
  26 /// TCoreException::TCoreException
27 27 /// @date 2009/11/30
28 28 ///
29 29 /// @brief     Constructs core exception object with additional data.
30 30 /// @param[in] eErrorCode -            error code
31 31 /// @param[in] pszFile -           source file name
32 32 /// @param[in] stLineNumber -      source line number
33 33 /// @param[in] pszFunction -       function name in which the problem occured.
34 34 // ============================================================================
35 35 TCoreException::TCoreException(EGeneralErrors eErrorCode, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction) :
36 36         TBaseException(eErrorCode, _T(""), pszFile, stLineNumber, pszFunction)
37 37 {
38 38 }
39 39
40 40 // ============================================================================
41   /// chcore::TCoreException::TCoreException
  41 /// TCoreException::TCoreException
42 42 /// @date 2009/11/30
43 43 ///
44 44 /// @brief     Constructs core exception object with additional data.
45 45 /// @param[in] eErrorCode -        error code
46 46 /// @param[in] stdException -      standard exception info
47 47 /// @param[in] pszFile -           source file name
48 48 /// @param[in] stLineNumber -      source line number
49 49 /// @param[in] pszFunction -       function name in which the problem occured.
50 50 // ============================================================================
51 51 TCoreException::TCoreException(EGeneralErrors eErrorCode, std::exception& stdException, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction) :
52 52         TBaseException(eErrorCode, stdException.what(), pszFile, stLineNumber, pszFunction)
53 53 {
54 54 }
55 55
56 56 // ============================================================================
57   /// chcore::TCoreWin32Exception::TCoreWin32Exception
  57 /// TCoreWin32Exception::TCoreWin32Exception
58 58 /// @date 2011/07/18
59 59 ///
60 60 /// @brief     Constructs core win32 exception.
61 61 /// @param[in] eErrorCode - core error code
62 62 /// @param[in] dwWin32Exception - win32 error code
63 63 /// @param[in] pszFile -source file where the exception was thrown
64 64 /// @param[in] stLineNumber - source code line number where the exception was thrown
65 65 /// @param[in] pszFunction - function throwing the exception
66 66 // ============================================================================
67 67 TCoreWin32Exception::TCoreWin32Exception(EGeneralErrors eErrorCode, DWORD dwWin32Exception, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction) :
68 68         TBaseException(eErrorCode, _T(""), pszFile, stLineNumber, pszFunction),
69 69         m_dwWin32ErrorCode(dwWin32Exception)
70 70 {
71 71 }
72 72
73 73 // ============================================================================
74   /// chcore::TCoreWin32Exception::GetErrorInfo
  74 /// TCoreWin32Exception::GetErrorInfo
75 75 /// @date 2011/07/18
76 76 ///
77 77 /// @brief     Retrieves formatted exception information.
78 78 /// @param[in] pszBuffer - buffer for formatted string
79 79 /// @param[in] stMaxBuffer - max size of buffer
80 80 // ============================================================================
81 81 void TCoreWin32Exception::GetErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const
82 82 {
83 83         _snwprintf_s(pszBuffer, stMaxBuffer, _TRUNCATE, _T("Error code: %ld (win32 error code: %lu)"), m_eErrorCode, m_dwWin32ErrorCode);
84 84         pszBuffer[stMaxBuffer - 1] = _T('\0');
85 85 }
86 86
87 87 void TCoreWin32Exception::GetDetailedErrorInfo(wchar_t* pszBuffer, size_t stMaxBuffer) const
88 88 {
89 89         _snwprintf_s(pszBuffer, stMaxBuffer, _TRUNCATE, _T("Error code: %ld\r\nWin32 error code: %lu\r\nFile: %s\r\nFunction: %s\r\nLine no: %lu"), m_eErrorCode, m_dwWin32ErrorCode, m_pszFile, m_pszFunction, (unsigned long)m_stLineNumber);
90 90         pszBuffer[stMaxBuffer - 1] = _T('\0');
91 91 }
92 92
93 93 END_CHCORE_NAMESPACE