return EnvironmentFailureException.unexpectedState
("No response to request");
}
if (resp instanceof Fail) {
Fail fail = (Fail) resp;
switch (fail.getReason()) {
case MEMBER_NOT_FOUND:
return new MemberNotFoundException(fail.getMessage());
case IS_MASTER:
return new MasterStateException(fail.getMessage());
case IS_ALIVE:
return new ReplicaStateException(fail.getMessage());
case TRANSFER_FAIL:
return new MasterTransferFailureException
(fail.getMessage());
default:
return EnvironmentFailureException.
unexpectedState(fail.getMessage());
}
}
if (resp instanceof ProtocolError) {
return EnvironmentFailureException.unexpectedState