Skip to content

Commit

Permalink
Refactor if-else statement - 2
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya1702 committed May 13, 2024
1 parent 7509c6e commit d4f9b54
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/soroban-rpc/internal/methods/get_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,16 @@ LedgerLoop:
for ledgerSeq := start.LedgerSequence; ledgerSeq <= int32(ledgerRange.LastLedger.Sequence); ledgerSeq++ {
// Get ledger close meta from db
ledger, found, err := h.ledgerReader.GetLedger(ctx, uint32(ledgerSeq))
if !found {
return GetTransactionsResponse{}, &jrpc2.Error{
Code: jrpc2.InvalidParams,
Message: errors.Errorf("ledger close meta not found: %d", ledgerSeq).Error(),
}
} else if err != nil {
if err != nil {
return GetTransactionsResponse{}, &jrpc2.Error{
Code: jrpc2.InternalError,
Message: err.Error(),
}
} else if !found {
return GetTransactionsResponse{}, &jrpc2.Error{
Code: jrpc2.InvalidParams,
Message: errors.Errorf("ledger close meta not found: %d", ledgerSeq).Error(),
}
}

// Initialise tx reader.
Expand Down

0 comments on commit d4f9b54

Please sign in to comment.