use of com.cloud.exception.ResourceInUseException in project cloudstack by apache.
the class DeleteConditionCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
boolean result = false;
try {
result = _autoScaleService.deleteCondition(getId());
} catch (ResourceInUseException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
}
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
s_logger.warn("Failed to delete condition " + getId());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete condition.");
}
}
use of com.cloud.exception.ResourceInUseException in project cloudstack by apache.
the class DeleteCounterCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
boolean result = false;
try {
result = _autoScaleService.deleteCounter(getId());
} catch (ResourceInUseException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
}
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
s_logger.warn("Failed to delete counter with Id: " + getId());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete counter.");
}
}
Aggregations