aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Udovichenko <rvu@ydb.tech>2024-01-29 17:42:40 +0300
committerGitHub <noreply@github.com>2024-01-29 17:42:40 +0300
commitb16f3dbe24193834fc5fcbc2c27889b3831c219d (patch)
tree2075b9da46c752d318de34407bca31046a32a352
parentccbe144622ee7d70e398162c16aa5558887435c1 (diff)
downloadydb-b16f3dbe24193834fc5fcbc2c27889b3831c219d.tar.gz
[dq] Don't return future with exception from ExecPlan call (YQL-17677) (#1374)
-rw-r--r--ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp b/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp
index a6d15b70ba..9c4c0565fb 100644
--- a/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp
+++ b/ydb/library/yql/providers/dq/provider/yql_dq_gateway.cpp
@@ -526,13 +526,24 @@ public:
std::shared_ptr<TDqGatewaySession> session;
with_lock(Mutex) {
auto it = Sessions.find(sessionId);
- if (it == Sessions.end()) {
- YQL_CLOG(ERROR, ProviderDq) << "Session was closed: " << sessionId;
- return MakeErrorFuture<TResult>(std::make_exception_ptr(std::runtime_error("Session was closed")));
+ if (it != Sessions.end()) {
+ session = it->second;
}
- session = it->second;
}
- return session->ExecutePlan(std::move(plan), columns, secureParams, graphParams, settings, progressWriter, modulesMapping, discard);
+ if (!session) {
+ YQL_CLOG(ERROR, ProviderDq) << "Session was closed: " << sessionId;
+ return MakeFuture(NCommon::ResultFromException<TResult>(yexception() << "Session was closed"));
+ }
+ return session->ExecutePlan(std::move(plan), columns, secureParams, graphParams, settings, progressWriter, modulesMapping, discard)
+ .Apply([](const TFuture<TResult>& f) {
+ try {
+ f.TryRethrow();
+ } catch (const std::exception& e) {
+ YQL_CLOG(ERROR, ProviderDq) << e.what();
+ return MakeFuture(NCommon::ResultFromException<TResult>(e));
+ }
+ return f;
+ });
}
private: