What’s the difference between throwing a winrt::hresult_error and using winrt::throw_hresult?

3 · Raymond Chen · July 16, 2021, 3:22 p.m.
There are two ways to throw an exception in C++/WinRT. You can throw the exception object directly: throw winrt::hresult_invalid_argument(); throw winrt::hresult_error(D3DERR_DEVICELOST); Or you can use the throw_hresult function. winrt::throw_hresult(E_INVALIDARG); winrt::throw_hresult(D3DERR_DEVICELOST); What’s the difference? If you look at the code for the throw_hresult function, The post What’s the difference between throwing a <CODE>winrt::hresult_error</CODE> and using <CODE>winrt::throw_...