use of com.eightkdata.mongowp.client.core.MongoConnection.ErroneousRemoteCommandResponse in project torodb by torodb.
the class TopologyHeartbeatHandler method handleHeartbeatError.
@Nonnull
private RemoteCommandResponse<ReplSetHeartbeatReply> handleHeartbeatError(Throwable t, Instant start) {
Duration d = Duration.between(clock.instant(), start);
ErrorCode errorCode;
if (t instanceof MongoException) {
return new FromExceptionRemoteCommandRequest((MongoException) t, d);
} else if (t instanceof UnreachableMongoServerException) {
errorCode = ErrorCode.HOST_UNREACHABLE;
} else {
if (!(t instanceof MongoRuntimeException) && !(t instanceof UnreachableMongoServerException)) {
LOGGER.warn("Unexpected exception {} catched by the topology " + "heartbeat handler", t.getClass().getSimpleName());
}
errorCode = ErrorCode.UNKNOWN_ERROR;
}
return new ErroneousRemoteCommandResponse<>(errorCode, t.getLocalizedMessage(), d);
}
Aggregations