MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / GetErrorMessage

Function GetErrorMessage

CppCoverage/CppCoverageException.cpp:27–46  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

25{
26 //-------------------------------------------------------------------------
27 std::wstring GetErrorMessage(int lastErrorCode)
28 {
29 std::vector<wchar_t> sysMsg(64 * 1024);
30 std::wostringstream ostr;
31
32 if (FormatMessage(
33 FORMAT_MESSAGE_FROM_SYSTEM,
34 NULL, lastErrorCode,
35 MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
36 &sysMsg[0], static_cast<int>(sysMsg.size()), NULL))
37 {
38 ostr << &sysMsg[0];
39 }
40 else
41 {
42 ostr << "Last error code:" << lastErrorCode;
43 }
44
45 return ostr.str();
46 }
47}

Callers 3

StartMethod · 0.70
OnRipFunction · 0.70
TESTFunction · 0.50

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.40