From 9482cf358e55a27f480ff7a321643f0897ad2766 Mon Sep 17 00:00:00 2001 From: George Date: Wed, 21 Aug 2024 12:08:49 -0700 Subject: [PATCH 1/3] Specify object key in 404 error message --- ingest/ledgerbackend/ledger_buffer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingest/ledgerbackend/ledger_buffer.go b/ingest/ledgerbackend/ledger_buffer.go index 6965461bba..977034b376 100644 --- a/ingest/ledgerbackend/ledger_buffer.go +++ b/ingest/ledgerbackend/ledger_buffer.go @@ -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, "failed finding file: %s", objectKey) } defer reader.Close() From 8028817ccff6bf32d7488adaf0dfb11cdb6d6378 Mon Sep 17 00:00:00 2001 From: George Date: Wed, 21 Aug 2024 12:26:32 -0700 Subject: [PATCH 2/3] Update tests to match new error message --- ingest/ledgerbackend/buffered_storage_backend_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ingest/ledgerbackend/buffered_storage_backend_test.go b/ingest/ledgerbackend/buffered_storage_backend_test.go index ca2711c40d..6c95b465f7 100644 --- a/ingest/ledgerbackend/buffered_storage_backend_test.go +++ b/ingest/ledgerbackend/buffered_storage_backend_test.go @@ -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) { @@ -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") } From 7a70b25e3c31a873ed0bdc99403d74b4c73a757c Mon Sep 17 00:00:00 2001 From: George Date: Tue, 27 Aug 2024 13:07:20 -0700 Subject: [PATCH 3/3] Better error itself --- ingest/ledgerbackend/ledger_buffer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingest/ledgerbackend/ledger_buffer.go b/ingest/ledgerbackend/ledger_buffer.go index 977034b376..d23bf0bfbd 100644 --- a/ingest/ledgerbackend/ledger_buffer.go +++ b/ingest/ledgerbackend/ledger_buffer.go @@ -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, errors.Wrapf(err, "failed finding file: %s", objectKey) + return nil, errors.Wrapf(err, "unable to retrieve file: %s", objectKey) } defer reader.Close()