File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -313,8 +313,8 @@ WINRT_EXPORT namespace winrt
313313 }
314314
315315 com_ptr<impl::IErrorInfo> info;
316- WINRT_VERIFY_ ( 0 , WINRT_IMPL_GetErrorInfo (0 , info.put_void () ));
317- WINRT_VERIFY ( info.try_as (m_info) );
316+ WINRT_IMPL_GetErrorInfo (0 , info.put_void ());
317+ info.try_as (m_info);
318318 }
319319
320320 static hresult verify_error (hresult const code) noexcept
Original file line number Diff line number Diff line change 1+ #include " pch.h"
2+ #include < roerrorapi.h>
3+
4+ TEST_CASE (" suppress_error_info" )
5+ {
6+ winrt::check_hresult (RoSetErrorReportingFlags (RO_ERROR_REPORTING_SUPPRESSSETERRORINFO));
7+
8+ // Since the error information is suppressed, the best we can hope for is that C++/WinRT
9+ // will provide a generic message for the HRESULT.
10+ REQUIRE (winrt::hresult_error (E_FAIL, L" message" ).message () == L" Unspecified error" );
11+
12+ winrt::check_hresult (RoSetErrorReportingFlags (RO_ERROR_REPORTING_USESETERRORINFO));
13+
14+ // The default behavior has been restored, so C++/WinRT can faithfully provide error
15+ // information as usual.
16+ REQUIRE (winrt::hresult_error (E_FAIL, L" message" ).message () == L" message" );
17+ }
Original file line number Diff line number Diff line change 418418 <ClCompile Include =" single_threaded_observable_vector.cpp" />
419419 <ClCompile Include =" structs.cpp" />
420420 <ClCompile Include =" struct_delegate.cpp" />
421+ <ClCompile Include =" suppress_error_info.cpp" />
421422 <ClCompile Include =" tearoff.cpp" />
422423 <ClCompile Include =" thread_pool.cpp" />
423424 <ClCompile Include =" uniform_in_params.cpp" />
You can’t perform that action at this time.
0 commit comments