Skip to content

Commit

Permalink
more better geterrorstring
Browse files Browse the repository at this point in the history
no holds barred
  • Loading branch information
poco0317 committed Sep 2, 2023
1 parent ace7a7a commit ca15715
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/RageUtil/Graphics/RageDisplay_D3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,19 @@ const WCHAR* WINAPI DXGetErrorStringW( _In_ HRESULT hr )

auto GetErrorString(HRESULT hr) -> std::string
{
Locator::getLogger()->warn("RageDisplay_D3D::GetErrorString() - HR {}",
static_cast<long>(hr));
const wchar_t* msg = DXGetErrorStringW(hr);
if (msg) {
return WStringToString(std::wstring(msg));
auto r = WStringToString(std::wstring(msg));
if (r.compare("Unknown error.") == 0) {
return fmt::format("Unknown error: HR {}", static_cast<long>(hr));
} else {
return r;
}
} else {
return fmt::format("Unknown error: HR {}", static_cast<long>(hr));
return fmt::format("Failed to read error: HR {}",
static_cast<long>(hr));
}
}

Expand Down

0 comments on commit ca15715

Please sign in to comment.