diff options
author | Rob Mensching <rob@firegiant.com> | 2021-04-22 06:38:23 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-04-29 16:21:09 -0700 |
commit | 7f642e51670bc38a4ef782a363936850bc2b0ba9 (patch) | |
tree | 19684b2d94979f130c0935328f0d44cf006e45ef /src/libs/dutil/test/DUtilUnitTest/error.cpp | |
parent | f39e7a3e164d0736e45049e5726d0da2013da3c9 (diff) | |
download | wix-7f642e51670bc38a4ef782a363936850bc2b0ba9.tar.gz wix-7f642e51670bc38a4ef782a363936850bc2b0ba9.tar.bz2 wix-7f642e51670bc38a4ef782a363936850bc2b0ba9.zip |
Move dutil into libs/dutil
Diffstat (limited to 'src/libs/dutil/test/DUtilUnitTest/error.cpp')
-rw-r--r-- | src/libs/dutil/test/DUtilUnitTest/error.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libs/dutil/test/DUtilUnitTest/error.cpp b/src/libs/dutil/test/DUtilUnitTest/error.cpp new file mode 100644 index 00000000..e51971c3 --- /dev/null +++ b/src/libs/dutil/test/DUtilUnitTest/error.cpp | |||
@@ -0,0 +1,26 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | const int ERROR_STRING_BUFFER = 1024; | ||
6 | |||
7 | static char szMsg[ERROR_STRING_BUFFER]; | ||
8 | static WCHAR wzMsg[ERROR_STRING_BUFFER]; | ||
9 | |||
10 | void CALLBACK DutilTestTraceError( | ||
11 | __in_z LPCSTR /*szFile*/, | ||
12 | __in int /*iLine*/, | ||
13 | __in REPORT_LEVEL /*rl*/, | ||
14 | __in UINT source, | ||
15 | __in HRESULT hrError, | ||
16 | __in_z __format_string LPCSTR szFormat, | ||
17 | __in va_list args | ||
18 | ) | ||
19 | { | ||
20 | if (DUTIL_SOURCE_EXTERNAL == source) | ||
21 | { | ||
22 | ::StringCchPrintfA(szMsg, countof(szMsg), szFormat, args); | ||
23 | MultiByteToWideChar(CP_ACP, 0, szMsg, -1, wzMsg, countof(wzMsg)); | ||
24 | throw gcnew System::Exception(System::String::Format("hr = 0x{0:X8}, message = {1}", hrError, gcnew System::String(wzMsg))); | ||
25 | } | ||
26 | } | ||