Skip to content

Commit

Permalink
Print getPeers errors in PostgresWsvQuery (hyperledger-iroha#1117)
Browse files Browse the repository at this point in the history
Print getPeers errors in PostgresWsvQuery

Signed-off-by: Andrei Lebedev <[email protected]>
  • Loading branch information
lebdron authored and x3medima17 committed Mar 30, 2018
1 parent 1e3139b commit fc189c1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions irohad/ametsuchi/impl/postgres_wsv_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,23 +187,24 @@ namespace iroha {
};
}

boost::optional<
std::vector<std::shared_ptr<shared_model::interface::Peer>>>
boost::optional<std::vector<std::shared_ptr<shared_model::interface::Peer>>>
PostgresWsvQuery::getPeers() {
pqxx::result result;
return execute_("SELECT * FROM peer;") | [&](const auto &result)
-> boost::optional<std::vector<
std::shared_ptr<shared_model::interface::Peer>>> {
auto results = transform<shared_model::builder::BuilderResult<shared_model::interface::Peer>>(
result, makePeer);
auto results = transform<shared_model::builder::BuilderResult<
shared_model::interface::Peer>>(result, makePeer);
std::vector<std::shared_ptr<shared_model::interface::Peer>> peers;
for (auto &r : results) {
r.match(
[&](expected::Value<
std::shared_ptr<shared_model::interface::Peer>> &v) {
peers.push_back(v.value);
},
[&](expected::Error<std::shared_ptr<std::string>> &e) {});
[&](expected::Error<std::shared_ptr<std::string>> &e) {
log_->info(*e.error);
});
}
return peers;
};
Expand Down

0 comments on commit fc189c1

Please sign in to comment.