CLOUDSTACK-5913:API rate limiting throws a different error than expected

when Throttle limit hit in the API.
This commit is contained in:
Min Chen 2014-01-20 15:49:19 -08:00
parent 90e945fd74
commit 3689f72f27
1 changed files with 5 additions and 2 deletions

View File

@ -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