Skip to content

Commit

Permalink
ingest: Add verbosity to missing file error for `BufferedStorageBacke…
Browse files Browse the repository at this point in the history
…nd` (stellar#5442)

* Specify object key in 404 error message
* Update tests to match new error message
  • Loading branch information
Shaptic authored Aug 27, 2024
1 parent 2349c8f commit f10ea0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions ingest/ledgerbackend/buffered_storage_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,9 @@ func TestLedgerBufferBoundedObjectNotFound(t *testing.T) {
bsb.ledgerBuffer.wg.Wait()

_, err := bsb.GetLedger(ctx, 3)
assert.EqualError(t, err, "failed getting next ledger batch from queue: ledger object containing sequence 3 is missing: file does not exist")
assert.ErrorContains(t, err, "ledger object containing sequence 3 is missing")
assert.ErrorContains(t, err, objectName)
assert.ErrorContains(t, err, "file does not exist")
}

func TestLedgerBufferUnboundedObjectNotFound(t *testing.T) {
Expand Down Expand Up @@ -571,5 +573,8 @@ func TestLedgerBufferRetryLimit(t *testing.T) {
bsb.ledgerBuffer.wg.Wait()

_, err := bsb.GetLedger(context.Background(), 3)
assert.EqualError(t, err, "failed getting next ledger batch from queue: maximum retries exceeded for downloading object containing sequence 3: transient error")
assert.ErrorContains(t, err, "failed getting next ledger batch from queue")
assert.ErrorContains(t, err, "maximum retries exceeded for downloading object containing sequence 3")
assert.ErrorContains(t, err, objectName)
assert.ErrorContains(t, err, "transient error")
}
2 changes: 1 addition & 1 deletion ingest/ledgerbackend/ledger_buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (lb *ledgerBuffer) downloadLedgerObject(ctx context.Context, sequence uint3

reader, err := lb.dataStore.GetFile(ctx, objectKey)
if err != nil {
return nil, err
return nil, errors.Wrapf(err, "unable to retrieve file: %s", objectKey)
}

defer reader.Close()
Expand Down

0 comments on commit f10ea0f

Please sign in to comment.