Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Don't log expected failures as errors #1054

Merged
merged 2 commits into from Mar 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -12,9 +12,11 @@
*/
package tech.pegasys.pantheon.ethereum.eth.manager.task;

import tech.pegasys.pantheon.ethereum.eth.manager.exceptions.EthTaskException;
import tech.pegasys.pantheon.metrics.Counter;
import tech.pegasys.pantheon.metrics.MetricCategory;
import tech.pegasys.pantheon.metrics.MetricsSystem;
import tech.pegasys.pantheon.util.ExceptionUtils;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -119,9 +121,13 @@ public void shutdown() {
}

protected void failExceptionally(final Throwable t) {
if (!(t instanceof InterruptedException)) {
Throwable rootCause = ExceptionUtils.rootCause(t);
if (rootCause instanceof InterruptedException || rootCause instanceof EthTaskException) {
LOG.debug("Task Failure: {}", t.toString());
} else {
LOG.error("Task Failure", t);
}

processingException.compareAndSet(null, t);
result.get().completeExceptionally(t);
cancel();
Expand Down