MCPcopy Create free account
hub / github.com/Icinga/icinga2 / formatErrorInfo

Function formatErrorInfo

plugins/thresholds.cpp:253–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253std::wstring formatErrorInfo(unsigned long err) {
254 std::wostringstream out;
255 if (!err)
256 err = GetLastError();
257 LPWSTR mBuf = NULL;
258 if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
259 NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&mBuf, 0, NULL))
260 out << "Failed to format error message, last error was: " << err;
261 else {
262 std::wstring tempOut = std::wstring(mBuf);
263 boost::trim_right(tempOut);
264 out << tempOut;
265 }
266
267 return out.str();
268}
269
270std::wstring stateToString(const state& state) {
271 switch (state) {

Callers 1

resolveHostnameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected