@Override
public final T handleException(Request request, Exception exception)
{
if (exception instanceof InterruptedException) {
throw new DiscoveryException(name + " was interrupted");
}
if (exception instanceof CancellationException) {
throw new DiscoveryException(name + " was canceled");
}
if (exception instanceof DiscoveryException) {
throw (DiscoveryException) exception;
}
throw new DiscoveryException(name + " failed", exception);
}