Skip to content

Commit 18a57a8

Browse files
committed
address avoid_oritinate comment, no need for a different name, resuse existing hresult_cancelled
1 parent 783413a commit 18a57a8

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

strings/base_coroutine_foundation.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ namespace winrt::impl
490490
m_status.store(AsyncStatus::Canceled, std::memory_order_relaxed);
491491
if (cancellable_promise::avoid_cancel_origination_enabled())
492492
{
493-
m_exception = std::make_exception_ptr(non_originating_hresult_canceled());
493+
m_exception = std::make_exception_ptr(hresult_canceled(hresult_error::avoid_originate));
494494
}
495495
else
496496
{
@@ -628,10 +628,6 @@ namespace winrt::impl
628628
{
629629
m_status.store(AsyncStatus::Canceled, std::memory_order_relaxed);
630630
}
631-
catch (non_originating_hresult_canceled const&)
632-
{
633-
m_status.store(AsyncStatus::Canceled, std::memory_order_relaxed);
634-
}
635631
catch (...)
636632
{
637633
m_status.store(AsyncStatus::Error, std::memory_order_relaxed);
@@ -645,7 +641,7 @@ namespace winrt::impl
645641
{
646642
if (cancellable_promise::avoid_cancel_origination_enabled())
647643
{
648-
throw winrt::non_originating_hresult_canceled();
644+
throw winrt::hresult_canceled(hresult_error::avoid_originate);
649645
}
650646
else
651647
{

strings/base_error.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,17 +332,11 @@ WINRT_EXPORT namespace winrt
332332
struct hresult_canceled : hresult_error
333333
{
334334
hresult_canceled(winrt::impl::slim_source_location const& sourceInformation = winrt::impl::slim_source_location::current()) noexcept : hresult_error(impl::error_canceled, sourceInformation) {}
335+
hresult_canceled(hresult_error::avoid_originate_t) noexcept : hresult_error(impl::error_canceled, hresult_error::avoid_originate) {}
335336
hresult_canceled(param::hstring const& message, winrt::impl::slim_source_location const& sourceInformation = winrt::impl::slim_source_location::current()) noexcept : hresult_error(impl::error_canceled, message, sourceInformation) {}
336337
hresult_canceled(take_ownership_from_abi_t, winrt::impl::slim_source_location const& sourceInformation = winrt::impl::slim_source_location::current()) noexcept : hresult_error(impl::error_canceled, take_ownership_from_abi, sourceInformation) {}
337338
};
338339

339-
struct non_originating_hresult_canceled : hresult_error
340-
{
341-
non_originating_hresult_canceled(winrt::impl::slim_source_location const& sourceInformation = winrt::impl::slim_source_location::current()) noexcept : hresult_error(impl::error_canceled, hresult_error::avoid_originate, sourceInformation) {}
342-
non_originating_hresult_canceled(param::hstring const& message, winrt::impl::slim_source_location const& sourceInformation = winrt::impl::slim_source_location::current()) = delete;
343-
non_originating_hresult_canceled(take_ownership_from_abi_t , winrt::impl::slim_source_location const& sourceInformation = winrt::impl::slim_source_location::current()) = delete;
344-
};
345-
346340
[[noreturn]] inline WINRT_IMPL_NOINLINE void throw_hresult(hresult const result, winrt::impl::slim_source_location const& sourceInformation = winrt::impl::slim_source_location::current())
347341
{
348342
if (winrt_throw_hresult_handler)

test/old_tests/UnitTests/TryLookup.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,4 @@ TEST_CASE("trylookup_from_abi specialization")
187187
REQUIRE_THROWS_AS(map.TryLookup(123), hresult_wrong_thread);
188188
// regular lookup should throw the same error
189189
REQUIRE_THROWS_AS(map.Lookup(123), hresult_wrong_thread);
190-
191-
192190
}

0 commit comments

Comments
 (0)