throw_hresult has winrt_throw_hresult_handler to call out to logging libraries (such as WIL) when errors are encountered. There is an incomplete note that source information (file, function name, line) are not hooked up. C++20 adds std::source_location which will unblock filling in that information.