Skip to content

Commit 06df476

Browse files
committed
Executor: throw if it's impossible to return a connection.
1 parent ee6c6de commit 06df476

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/oatpp-postgresql/Executor.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,11 @@ data::share::StringTemplate Executor::parseQueryTemplate(const oatpp::String& na
283283
}
284284

285285
std::shared_ptr<orm::Connection> Executor::getConnection() {
286-
return m_connectionProvider->get();
286+
auto connection = m_connectionProvider->get();
287+
if(connection) {
288+
return connection;
289+
}
290+
throw std::runtime_error("[oatpp::postgresql::Executor::getConnection()]: Error. Can't connect.");
287291
}
288292

289293
std::shared_ptr<orm::QueryResult> Executor::execute(const StringTemplate& queryTemplate,

0 commit comments

Comments
 (0)