future.setException(((Responses.Error)response).asException(connection.address));
break;
default:
// This mean we have probably have a bad node, so defunct the connection
connection.defunct(new ConnectionException(connection.address, String.format("Got unexpected %s response", response.type)));
future.setException(new DriverInternalError(String.format("Got unexpected %s response from %s", response.type, connection.address)));
break;
}
} catch (RuntimeException e) {
// If we get a bug here, the client will not get it, so better forwarding the error
future.setException(new DriverInternalError("Unexpected error while processing response from " + connection.address, e));
}
}
// This is only called for internal calls, so don't bother with ExecutionInfo
@Override