mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-03 12:25:54 +02:00
Show descriptive error messages when FileCommit fails
Only raw errno codes are logged if FileCommit fails. These are implementation-specific, so it makes it harder to debug based on user reports. Instead, use SysErrorString to display both the raw int value and the descriptive message.
This commit is contained in:
@@ -419,18 +419,7 @@ void Sock::Close()
|
||||
#ifdef WIN32
|
||||
std::string NetworkErrorString(int err)
|
||||
{
|
||||
wchar_t buf[256];
|
||||
buf[0] = 0;
|
||||
if(FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK,
|
||||
nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
buf, ARRAYSIZE(buf), nullptr))
|
||||
{
|
||||
return strprintf("%s (%d)", std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().to_bytes(buf), err);
|
||||
}
|
||||
else
|
||||
{
|
||||
return strprintf("Unknown error (%d)", err);
|
||||
}
|
||||
return Win32ErrorString(err);
|
||||
}
|
||||
#else
|
||||
std::string NetworkErrorString(int err)
|
||||
|
||||
Reference in New Issue
Block a user