Skip to content

Commit 46f64de

Browse files
committed
Move check_cast_result to impl namespace. Throw an hresult_error directly taking ownership of error info instead of re-originating
1 parent 8b91053 commit 46f64de

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

strings/base_error.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,24 @@ WINRT_EXPORT namespace winrt
529529
return pointer;
530530
}
531531

532+
[[noreturn]] inline void terminate() noexcept
533+
{
534+
WINRT_IMPL_RoFailFastWithErrorContext(to_hresult());
535+
abort();
536+
}
537+
}
538+
539+
namespace winrt::impl
540+
{
541+
inline hresult check_hresult_allow_bounds(hresult const result WINRT_IMPL_SOURCE_LOCATION_ARGS)
542+
{
543+
if (result != impl::error_out_of_bounds && result != impl::error_fail && result != impl::error_file_not_found)
544+
{
545+
check_hresult(result WINRT_IMPL_SOURCE_LOCATION_FORWARD);
546+
}
547+
return result;
548+
}
549+
532550
template <typename T>
533551
WINRT_IMPL_NOINLINE void check_cast_result(T* from WINRT_IMPL_SOURCE_LOCATION_ARGS)
534552
{
@@ -545,29 +563,11 @@ WINRT_EXPORT namespace winrt
545563
impl::bstr_handle capabilitySid;
546564
if (restrictedError->GetErrorDetails(description.put(), &code, restrictedDescription.put(), capabilitySid.put()) == 0)
547565
{
548-
check_hresult(code WINRT_IMPL_SOURCE_LOCATION_FORWARD);
566+
throw hresult_error(code, take_ownership_from_abi WINRT_IMPL_SOURCE_LOCATION_FORWARD);
549567
}
550568
}
551569
}
552570
}
553-
554-
[[noreturn]] inline void terminate() noexcept
555-
{
556-
WINRT_IMPL_RoFailFastWithErrorContext(to_hresult());
557-
abort();
558-
}
559-
}
560-
561-
namespace winrt::impl
562-
{
563-
inline hresult check_hresult_allow_bounds(hresult const result WINRT_IMPL_SOURCE_LOCATION_ARGS)
564-
{
565-
if (result != impl::error_out_of_bounds && result != impl::error_fail && result != impl::error_file_not_found)
566-
{
567-
check_hresult(result WINRT_IMPL_SOURCE_LOCATION_FORWARD);
568-
}
569-
return result;
570-
}
571571
}
572572

573573
#undef WINRT_IMPL_RETURNADDRESS

0 commit comments

Comments
 (0)