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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to