1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Always print system error code on 'throwing' errors.

Print system error code in src_loc fmt.
Error code may be irrelevant though.
This commit is contained in:
Nekotekina 2020-12-10 12:42:02 +03:00
parent 36c8654fb8
commit 61b882b2a6

View File

@ -264,6 +264,19 @@ void fmt_class_string<src_loc>::format(std::string& out, u64 arg)
{
out += ')';
}
// Print error code (may be irrelevant)
#ifdef _WIN32
if (DWORD error = GetLastError())
{
fmt::append(out, " (e=0x%08x[%u])", error, error);
}
#else
if (int error = errno)
{
fmt::append(out, " (errno=%d)", error);
}
#endif
}
namespace fmt
@ -271,27 +284,13 @@ namespace fmt
void raw_verify_error(const src_loc& loc)
{
std::string out{"Verification failed"};
// Print error code (may be irrelevant)
#ifdef _WIN32
if (DWORD error = GetLastError())
{
fmt::append(out, " (e=%#x):", error);
}
#else
if (int error = errno)
{
fmt::append(out, " (e=%d):", error);
}
#endif
fmt::append(out, "%s", loc);
thread_ctrl::emergency_exit(out);
}
void raw_narrow_error(const src_loc& loc, const fmt_type_info* sup, u64 arg)
{
std::string out{"Narrow error"};
std::string out{"Narrowing error"};
if (sup)
{