refactor: Make getLedgerIndex return std::expected instead of throwing (#2788)

Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
Co-authored-by: Sergey Kuznetsov <kuzzz99@gmail.com>
This commit is contained in:
emrearıyürek
2025-11-20 18:46:15 +01:00
committed by GitHub
parent e3170203de
commit 2cd8226a11
30 changed files with 290 additions and 89 deletions

View File

@@ -109,8 +109,11 @@ tag_invoke(boost::json::value_to_tag<TransactionEntryHandler::Input>, boost::jso
if (jsonObject.contains(JS(ledger_hash)))
input.ledgerHash = boost::json::value_to<std::string>(jv.at(JS(ledger_hash)));
if (jsonObject.contains(JS(ledger_index)))
input.ledgerIndex = util::getLedgerIndex(jv.at(JS(ledger_index)));
if (jsonObject.contains(JS(ledger_index))) {
auto const expectedLedgerIndex = util::getLedgerIndex(jv.at(JS(ledger_index)));
if (expectedLedgerIndex.has_value())
input.ledgerIndex = *expectedLedgerIndex;
}
return input;
}