I have following code
IAsyncOperation<bool> trythiswork()
{
bool contentFound{ false };
try
{
auto result = co_await someAsyncFunc();
if (result)
{
throw;
contentFound = true;
}
}
catch (...)
{
LOG_CAUGHT_EXCEPTION();
}
}
But the catch block is never executed even when control goes to throw statement after the if condition is met. And control goes to contentFound = true; after the throw.
Is there something wrong with how I am throwing from this method? Can you help me in throwing from this async method? I am expecting that catch block will be executed and the line contentFound = true; will not be executed. Thanks