private static DeleteVmResponse checkDeleteVmResponse(DeleteVmResponse deleteVmResponse) throws RpcException {
  logger.info("Checking {}",deleteVmResponse);
switch (deleteVmResponse.getResult()) {
case OK:
    break;
case SYSTEM_ERROR:
  throw new SystemErrorException(deleteVmResponse.getError());
case VM_NOT_FOUND:
throw new VmNotFoundException(deleteVmResponse.getError());
case VM_NOT_POWERED_OFF:
throw new VmNotPoweredOffException(deleteVmResponse.getError());
default :
throw new RpcException(String.format("Unknown response: %s",deleteVmResponse.getResult()));
}
return deleteVmResponse;
}

private static DeleteVmResponse checkDeleteVmResponse ( DeleteVmResponse deleteVmResponse ) throws RpcException { logger . info ( "Checking {}" , deleteVmResponse ) ; switch ( deleteVmResponse . getResult ( ) ) { case OK : break ; case SYSTEM_ERROR : throw new SystemErrorException ( deleteVmResponse . getError ( ) ) ; case VM_NOT_FOUND : throw new VmNotFoundException ( deleteVmResponse . getError ( ) ) ; case VM_NOT_POWERED_OFF : throw new VmNotPoweredOffException ( deleteVmResponse . getError ( ) ) ; default : throw new RpcException ( String . format ( "Unknown response: %s" , deleteVmResponse . getResult ( ) ) ) ; } return deleteVmResponse ; }
this method validates a deletevmresponse object , raising an exception if the response reflects an operation failure .
