mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-24 13:45:52 +00:00
refactor: Use std::expected instead of std::variant for errors (#2160)
This commit is contained in:
@@ -46,17 +46,17 @@ TransactionEntryHandler::process(TransactionEntryHandler::Input input, Context c
|
||||
auto const range = sharedPtrBackend_->fetchLedgerRange();
|
||||
ASSERT(range.has_value(), "TransactionEntry's ledger range must be available");
|
||||
|
||||
auto const lgrInfoOrStatus = getLedgerHeaderFromHashOrSeq(
|
||||
auto const expectedLgrInfo = getLedgerHeaderFromHashOrSeq(
|
||||
*sharedPtrBackend_, ctx.yield, input.ledgerHash, input.ledgerIndex, range->maxSequence
|
||||
);
|
||||
|
||||
if (auto status = std::get_if<Status>(&lgrInfoOrStatus))
|
||||
return Error{*status};
|
||||
if (!expectedLgrInfo.has_value())
|
||||
return Error{expectedLgrInfo.error()};
|
||||
|
||||
auto output = TransactionEntryHandler::Output{};
|
||||
output.apiVersion = ctx.apiVersion;
|
||||
|
||||
output.ledgerHeader = std::get<ripple::LedgerHeader>(lgrInfoOrStatus);
|
||||
output.ledgerHeader = expectedLgrInfo.value();
|
||||
auto const dbRet = sharedPtrBackend_->fetchTransaction(ripple::uint256{input.txHash.c_str()}, ctx.yield);
|
||||
// Note: transaction_entry is meant to only search a specified ledger for
|
||||
// the specified transaction. tx searches the entire range of history. For
|
||||
|
||||
Reference in New Issue
Block a user