mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-16 21:47:45 -04:00
Merge pull request #2574 from jpark37/winrt-catch-all
libobs-winrt: Stronger exception handling
This commit is contained in:
@@ -18,10 +18,14 @@ try {
|
||||
return winrt::Windows::Foundation::Metadata::ApiInformation::
|
||||
IsApiContractPresent(L"Windows.Foundation.UniversalApiContract",
|
||||
8);
|
||||
} catch (winrt::hresult_error &err) {
|
||||
} catch (const winrt::hresult_error &err) {
|
||||
blog(LOG_ERROR, "winrt_capture_supported (0x%08X): %ls", err.to_abi(),
|
||||
err.message().c_str());
|
||||
return false;
|
||||
} catch (...) {
|
||||
blog(LOG_ERROR, "winrt_capture_supported (0x%08X)",
|
||||
winrt::to_hresult());
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" EXPORT BOOL winrt_capture_cursor_toggle_supported()
|
||||
@@ -34,10 +38,14 @@ try {
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
} catch (winrt::hresult_error &err) {
|
||||
} catch (const winrt::hresult_error &err) {
|
||||
blog(LOG_ERROR, "winrt_capture_cursor_toggle_supported (0x%08X): %ls",
|
||||
err.to_abi(), err.message().c_str());
|
||||
return false;
|
||||
} catch (...) {
|
||||
blog(LOG_ERROR, "winrt_capture_cursor_toggle_supported (0x%08X)",
|
||||
winrt::to_hresult());
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -353,6 +361,10 @@ try {
|
||||
blog(LOG_ERROR, "CreateForWindow (0x%08X): %ls", err.to_abi(),
|
||||
err.message().c_str());
|
||||
return nullptr;
|
||||
} catch (...) {
|
||||
blog(LOG_ERROR, "CreateForWindow (0x%08X)",
|
||||
winrt::to_hresult());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice
|
||||
@@ -406,10 +418,13 @@ try {
|
||||
|
||||
return capture;
|
||||
|
||||
} catch (winrt::hresult_error &err) {
|
||||
} catch (const winrt::hresult_error &err) {
|
||||
blog(LOG_ERROR, "winrt_capture_init (0x%08X): %ls", err.to_abi(),
|
||||
err.message().c_str());
|
||||
return nullptr;
|
||||
} catch (...) {
|
||||
blog(LOG_ERROR, "winrt_capture_init (0x%08X)", winrt::to_hresult());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" EXPORT void winrt_capture_free(struct winrt_capture *capture)
|
||||
|
||||
Reference in New Issue
Block a user