5#include <bitcoin-build-config.h>
24 const char *
s =
nullptr;
26 if (strerror_s(buf,
sizeof(buf), err) == 0)
s = buf;
28#ifdef STRERROR_R_CHAR_P
29 s = strerror_r(err, buf,
sizeof(buf));
31 if (strerror_r(err, buf,
sizeof(buf)) == 0)
s = buf;
37 return strprintf(
"Unknown error (%d)", err);
42std::string Win32ErrorString(
int err)
46 if(FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK,
47 nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
48 buf, ARRAYSIZE(buf),
nullptr))
50 return strprintf(
"%s (%d)", std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,
wchar_t>().to_bytes(buf), err);
54 return strprintf(
"Unknown error (%d)", err);
std::string SysErrorString(int err)
Return system error string from errno value.