Common/Network: Add StrNetworkError helper function
This commit is contained in:
parent
b6ac63dc47
commit
e783a7f409
|
@ -566,4 +566,14 @@ const char* DecodeNetworkError(s32 error_code)
|
|||
return strerror_r(error_code, buffer, sizeof(buffer));
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* StrNetworkError()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const s32 error_code = WSAGetLastError();
|
||||
#else
|
||||
const s32 error_code = errno;
|
||||
#endif
|
||||
return DecodeNetworkError(error_code);
|
||||
}
|
||||
} // namespace Common
|
||||
|
|
|
@ -266,4 +266,5 @@ u16 ComputeTCPNetworkChecksum(const IPAddress& from, const IPAddress& to, const
|
|||
NetworkErrorState SaveNetworkErrorState();
|
||||
void RestoreNetworkErrorState(const NetworkErrorState& state);
|
||||
const char* DecodeNetworkError(s32 error_code);
|
||||
const char* StrNetworkError();
|
||||
} // namespace Common
|
||||
|
|
Loading…
Reference in New Issue