Executor: throw if it's impossible to return a connection.

This commit is contained in:
lganzzzo 2020-12-21 03:31:03 +02:00
parent ee6c6de4f6
commit 06df476b19

View File

@ -283,7 +283,11 @@ data::share::StringTemplate Executor::parseQueryTemplate(const oatpp::String& na
}
std::shared_ptr<orm::Connection> Executor::getConnection() {
return m_connectionProvider->get();
auto connection = m_connectionProvider->get();
if(connection) {
return connection;
}
throw std::runtime_error("[oatpp::postgresql::Executor::getConnection()]: Error. Can't connect.");
}
std::shared_ptr<orm::QueryResult> Executor::execute(const StringTemplate& queryTemplate,