diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp index f623919427..b31695df81 100644 --- a/Utilities/StrFmt.cpp +++ b/Utilities/StrFmt.cpp @@ -264,6 +264,19 @@ void fmt_class_string::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) {