Don't log expected failures as errors (#1054)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
mbaxter 6 years ago committed by GitHub
parent fec24292f1
commit 9ee3c5d1da
  1. 8
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/task/AbstractPipelinedTask.java

@ -12,9 +12,11 @@
*/ */
package tech.pegasys.pantheon.ethereum.eth.manager.task; 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.Counter;
import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricCategory;
import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.MetricsSystem;
import tech.pegasys.pantheon.util.ExceptionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -119,9 +121,13 @@ public abstract class AbstractPipelinedTask<I, O> extends AbstractEthTask<List<O
} }
protected void failExceptionally(final Throwable t) { 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); LOG.error("Task Failure", t);
} }
processingException.compareAndSet(null, t); processingException.compareAndSet(null, t);
result.get().completeExceptionally(t); result.get().completeExceptionally(t);
cancel(); cancel();

Loading…
Cancel
Save