Updated Branches:
  refs/heads/master 90e945fd7 -> 3689f72f2

CLOUDSTACK-5913:API rate limiting throws a different error than expected
when Throttle limit hit in the API.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3689f72f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3689f72f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3689f72f

Branch: refs/heads/master
Commit: 3689f72f273c772a964ce5c8eb6a294151bb25ab
Parents: 90e945f
Author: Min Chen <[email protected]>
Authored: Mon Jan 20 15:49:19 2014 -0800
Committer: Min Chen <[email protected]>
Committed: Mon Jan 20 15:49:19 2014 -0800

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServer.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3689f72f/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java 
b/server/src/com/cloud/api/ApiServer.java
index 3fb3495..71a1b8d 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -722,10 +722,13 @@ public class ApiServer extends ManagerBase implements 
HttpRequestHandler, ApiSer
 
             try {
                 checkCommandAvailable(user, commandName);
+            } catch (RequestLimitException ex) {
+                s_logger.debug(ex.getMessage());
+                throw new ServerApiException(ApiErrorCode.API_LIMIT_EXCEED, 
ex.getMessage());
             } catch (PermissionDeniedException ex) {
                 s_logger.debug("The given command:" + commandName + " does not 
exist or it is not available for user");
-                throw new 
ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "The given command:" 
+ commandName +
-                    " does not exist or it is not available for user with id:" 
+ userId);
+                throw new 
ServerApiException(ApiErrorCode.UNSUPPORTED_ACTION_ERROR, "The given command:" 
+ commandName + " does not exist or it is not available for user with id:"
+                        + userId);
             }
 
             // verify secret key exists

Reply via email to