You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/09/15 13:06:36 UTC

[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #5428: resource limit: Fix resource limit check on VM start

DaanHoogland commented on a change in pull request #5428:
URL: https://github.com/apache/cloudstack/pull/5428#discussion_r709163780



##########
File path: api/src/main/java/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
##########
@@ -263,13 +264,17 @@ public long getEntityOwnerId() {
     @Override
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException {
         CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId()));
-        UserVm result = _userVmService.updateVirtualMachine(this);
-        if (result != null){
-            UserVmResponse response = _responseGenerator.createUserVmResponse(getResponseView(), "virtualmachine", result).get(0);
-            response.setResponseName(getCommandName());
-            setResponseObject(response);
-        } else {
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm");
+        try {
+            UserVm result = _userVmService.updateVirtualMachine(this);
+            if (result != null) {
+                UserVmResponse response = _responseGenerator.createUserVmResponse(getResponseView(), "virtualmachine", result).get(0);
+                response.setResponseName(getCommandName());
+                setResponseObject(response);
+            } else {
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm");
+            }
+        } catch (Exception e) {

Review comment:
       this thrown exception will be caught immediately.
   can we be more specific in the catch, if not out of pokemon principle, at least to not catch the `ServerApiException`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org