Skip to content

Commit

Permalink
uniform error
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr committed Nov 6, 2024
1 parent 9012579 commit 0c197ce
Showing 1 changed file with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes32;
Expand Down Expand Up @@ -509,11 +508,7 @@ private BlockBlobSidecarsTracker internalOnNewBlock(
// Let's try now
if (!existingTracker.isLocalElFetchTriggered() && !existingTracker.isCompleted()) {
fetchMissingContentFromLocalEL(slotAndBlockRoot)
.finish(
error ->
LOG.error(
"An error occurred while attempting to fetch blobs via local EL: {}",
getRootCauseMessage(error)));
.finish(this::logLocalElBlobsLookupFailure);
}
}
});
Expand Down Expand Up @@ -599,18 +594,18 @@ private void onFirstSeen(
.runAfterDelay(
() ->
this.fetchMissingContentFromLocalEL(slotAndBlockRoot)
.handleException(
error ->
LOG.warn(
"Local EL blobs lookup failed: {}",
ExceptionUtils.getRootCauseMessage(error)))
.handleException(this::logLocalElBlobsLookupFailure)
.thenRun(() -> this.fetchMissingContentFromRemotePeers(slotAndBlockRoot)),
fetchDelay)
.finish(
error ->
LOG.error("An error occurred while attempting to fetch missing blobs.", error));
}

private void logLocalElBlobsLookupFailure(final Throwable error) {
LOG.warn("Local EL blobs lookup failed: {}", getRootCauseMessage(error));
}

@VisibleForTesting
Duration calculateFetchDelay(final SlotAndBlockRoot slotAndBlockRoot) {
final UInt64 slot = slotAndBlockRoot.getSlot();
Expand Down

0 comments on commit 0c197ce

Please sign in to comment.