Set exception for promise

This commit is contained in:
Antonio Andelic 2023-09-22 10:29:11 +00:00
parent ddf8ffb51c
commit a691dea6cf

View File

@ -8,7 +8,6 @@
#include <Storages/IStorage.h>
#include <Common/logger_useful.h>
#include <iomanip>
namespace DB
@ -39,6 +38,8 @@ CreatingSetsTransform::CreatingSetsTransform(
void CreatingSetsTransform::work()
{
try
{
if (!is_initialized)
init();
@ -49,6 +50,23 @@ void CreatingSetsTransform::work()
}
IAccumulatingTransform::work();
}
catch (...)
{
if (promise_to_build)
{
/// set_exception can also throw
try
{
promise_to_build->set_exception(std::current_exception());
}
catch (...)
{
tryLogCurrentException(log, "Failed to set_exception for promise");
}
}
throw;
}
}
void CreatingSetsTransform::startSubquery()