cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [10/13] git commit: Clean up ApiServer, ApiServlet and ApiDispatcher flow to handle various CloudRuntimeException and CloudException in one place, and Introduced ApiErrorCode to handle CloudStack API error code to standard Http code mapping.
Date Thu, 17 Jan 2013 23:17:48 GMT
Clean up ApiServer, ApiServlet and ApiDispatcher flow to handle various CloudRuntimeException
and CloudException in one place, and Introduced ApiErrorCode to handle CloudStack API error
code to standard Http code mapping.

Signed-off-by: Min Chen <min.chen@citrix.com>


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

Branch: refs/heads/api_limit
Commit: 3dabd5fbf3b0ddfcbe98e4a6178e206b1de2c7f7
Parents: c08d151
Author: Min Chen <min.chen@citrix.com>
Authored: Wed Jan 16 21:52:48 2013 -0800
Committer: Min Chen <min.chen@citrix.com>
Committed: Wed Jan 16 22:36:34 2013 -0800

----------------------------------------------------------------------
 .../api/commands/CreatePrivateNetworkCmd.java      |    8 +-
 .../cloud/api/commands/DestroyConsoleProxyCmd.java |    2 +-
 .../org/apache/cloudstack/api/ApiErrorCode.java    |   59 ++++
 api/src/org/apache/cloudstack/api/BaseCmd.java     |   25 +--
 .../api/BaseUpdateTemplateOrIsoPermissionsCmd.java |    2 +-
 .../apache/cloudstack/api/ServerApiException.java  |   33 ++-
 .../command/admin/account/CreateAccountCmd.java    |    2 +-
 .../command/admin/account/DeleteAccountCmd.java    |    2 +-
 .../command/admin/account/DisableAccountCmd.java   |    2 +-
 .../command/admin/account/EnableAccountCmd.java    |    3 +-
 .../api/command/admin/account/LockAccountCmd.java  |    2 +-
 .../command/admin/account/UpdateAccountCmd.java    |    3 +-
 .../command/admin/autoscale/CreateCounterCmd.java  |    3 +-
 .../command/admin/autoscale/DeleteCounterCmd.java  |    5 +-
 .../api/command/admin/cluster/AddClusterCmd.java   |    6 +-
 .../command/admin/cluster/DeleteClusterCmd.java    |    3 +-
 .../command/admin/cluster/UpdateClusterCmd.java    |    3 +-
 .../api/command/admin/config/UpdateCfgCmd.java     |    3 +-
 .../config/UpdateHypervisorCapabilitiesCmd.java    |    3 +-
 .../api/command/admin/domain/CreateDomainCmd.java  |    2 +-
 .../api/command/admin/domain/DeleteDomainCmd.java  |    2 +-
 .../api/command/admin/domain/UpdateDomainCmd.java  |    2 +-
 .../api/command/admin/host/AddHostCmd.java         |    5 +-
 .../command/admin/host/AddSecondaryStorageCmd.java |    4 +-
 .../command/admin/host/CancelMaintenanceCmd.java   |    3 +-
 .../api/command/admin/host/DeleteHostCmd.java      |    3 +-
 .../admin/host/PrepareForMaintenanceCmd.java       |    3 +-
 .../api/command/admin/host/ReconnectHostCmd.java   |    5 +-
 .../api/command/admin/host/UpdateHostCmd.java      |    3 +-
 .../command/admin/network/AddNetworkDeviceCmd.java |    5 +-
 .../network/AddNetworkServiceProviderCmd.java      |    5 +-
 .../admin/network/CreateNetworkOfferingCmd.java    |    2 +-
 .../admin/network/CreatePhysicalNetworkCmd.java    |    5 +-
 .../network/CreateStorageNetworkIpRangeCmd.java    |    3 +-
 .../admin/network/DeleteNetworkDeviceCmd.java      |    7 +-
 .../admin/network/DeleteNetworkOfferingCmd.java    |    3 +-
 .../network/DeleteNetworkServiceProviderCmd.java   |    7 +-
 .../admin/network/DeletePhysicalNetworkCmd.java    |    2 +-
 .../network/DeleteStorageNetworkIpRangeCmd.java    |    2 +-
 .../admin/network/ListNetworkDeviceCmd.java        |    5 +-
 .../admin/network/ListPhysicalNetworksCmd.java     |    3 +-
 .../network/ListStorageNetworkIpRangeCmd.java      |    2 +-
 .../admin/network/UpdateNetworkOfferingCmd.java    |    2 +-
 .../network/UpdateNetworkServiceProviderCmd.java   |    3 +-
 .../network/UpdateStorageNetworkIpRangeCmd.java    |    2 +-
 .../admin/offering/CreateDiskOfferingCmd.java      |    3 +-
 .../admin/offering/CreateServiceOfferingCmd.java   |    3 +-
 .../admin/offering/DeleteDiskOfferingCmd.java      |    3 +-
 .../admin/offering/DeleteServiceOfferingCmd.java   |    2 +-
 .../admin/offering/UpdateDiskOfferingCmd.java      |    3 +-
 .../admin/offering/UpdateServiceOfferingCmd.java   |    2 +-
 .../api/command/admin/pod/CreatePodCmd.java        |    2 +-
 .../api/command/admin/pod/DeletePodCmd.java        |    3 +-
 .../api/command/admin/pod/UpdatePodCmd.java        |    2 +-
 .../admin/resource/UploadCustomCertificateCmd.java |    2 +-
 .../router/ConfigureVirtualRouterElementCmd.java   |    3 +-
 .../router/CreateVirtualRouterElementCmd.java      |    4 +-
 .../api/command/admin/router/DestroyRouterCmd.java |    3 +-
 .../api/command/admin/router/RebootRouterCmd.java  |    2 +-
 .../api/command/admin/router/StartRouterCmd.java   |    2 +-
 .../api/command/admin/router/StopRouterCmd.java    |    3 +-
 .../api/command/admin/router/UpgradeRouterCmd.java |    2 +-
 .../api/command/admin/storage/AddS3Cmd.java        |    5 +-
 .../CancelPrimaryStorageMaintenanceCmd.java        |    3 +-
 .../admin/storage/CreateStoragePoolCmd.java        |    8 +-
 .../api/command/admin/storage/DeletePoolCmd.java   |    4 +-
 .../PreparePrimaryStorageForMaintenanceCmd.java    |    3 +-
 .../admin/storage/UpdateStoragePoolCmd.java        |    2 +-
 .../api/command/admin/swift/AddSwiftCmd.java       |    4 +-
 .../command/admin/systemvm/DestroySystemVmCmd.java |    2 +-
 .../command/admin/systemvm/MigrateSystemVMCmd.java |   11 +-
 .../command/admin/systemvm/RebootSystemVmCmd.java  |    3 +-
 .../command/admin/systemvm/StartSystemVMCmd.java   |    3 +-
 .../command/admin/systemvm/StopSystemVmCmd.java    |    2 +-
 .../command/admin/systemvm/UpgradeSystemVMCmd.java |    2 +-
 .../api/command/admin/usage/AddTrafficTypeCmd.java |    5 +-
 .../command/admin/usage/DeleteTrafficTypeCmd.java  |    3 +-
 .../command/admin/usage/UpdateTrafficTypeCmd.java  |    3 +-
 .../api/command/admin/user/CreateUserCmd.java      |    3 +-
 .../api/command/admin/user/DeleteUserCmd.java      |    3 +-
 .../api/command/admin/user/DisableUserCmd.java     |    3 +-
 .../api/command/admin/user/EnableUserCmd.java      |    2 +-
 .../api/command/admin/user/LockUserCmd.java        |    3 +-
 .../api/command/admin/user/UpdateUserCmd.java      |    2 +-
 .../command/admin/vlan/CreateVlanIpRangeCmd.java   |    6 +-
 .../command/admin/vlan/DeleteVlanIpRangeCmd.java   |    3 +-
 .../api/command/admin/vm/AssignVMCmd.java          |    4 +-
 .../api/command/admin/vm/MigrateVMCmd.java         |   10 +-
 .../api/command/admin/vm/RecoverVMCmd.java         |    3 +-
 .../command/admin/vpc/CreatePrivateGatewayCmd.java |    9 +-
 .../command/admin/vpc/CreateVPCOfferingCmd.java    |    4 +-
 .../command/admin/vpc/DeletePrivateGatewayCmd.java |    3 +-
 .../command/admin/vpc/DeleteVPCOfferingCmd.java    |    3 +-
 .../command/admin/vpc/UpdateVPCOfferingCmd.java    |    2 +-
 .../api/command/admin/zone/CreateZoneCmd.java      |    3 +-
 .../api/command/admin/zone/DeleteZoneCmd.java      |    2 +-
 .../admin/zone/MarkDefaultZoneForAccountCmd.java   |    3 +-
 .../api/command/admin/zone/UpdateZoneCmd.java      |    2 +-
 .../user/account/AddAccountToProjectCmd.java       |    2 +-
 .../user/account/DeleteAccountFromProjectCmd.java  |    2 +-
 .../command/user/address/AssociateIPAddrCmd.java   |    9 +-
 .../user/address/DisassociateIPAddrCmd.java        |    2 +-
 .../user/autoscale/CreateAutoScalePolicyCmd.java   |    2 +-
 .../user/autoscale/CreateAutoScaleVmGroupCmd.java  |    4 +-
 .../autoscale/CreateAutoScaleVmProfileCmd.java     |    3 +-
 .../command/user/autoscale/CreateConditionCmd.java |    3 +-
 .../user/autoscale/DeleteAutoScalePolicyCmd.java   |    3 +-
 .../user/autoscale/DeleteAutoScaleVmGroupCmd.java  |    3 +-
 .../autoscale/DeleteAutoScaleVmProfileCmd.java     |    3 +-
 .../command/user/autoscale/DeleteConditionCmd.java |    5 +-
 .../user/autoscale/DisableAutoScaleVmGroupCmd.java |    3 +-
 .../user/autoscale/EnableAutoScaleVmGroupCmd.java  |    2 +-
 .../user/autoscale/UpdateAutoScalePolicyCmd.java   |    3 +-
 .../user/autoscale/UpdateAutoScaleVmGroupCmd.java  |    2 +-
 .../autoscale/UpdateAutoScaleVmProfileCmd.java     |    2 +-
 .../user/firewall/CreateFirewallRuleCmd.java       |    7 +-
 .../user/firewall/CreatePortForwardingRuleCmd.java |    4 +-
 .../user/firewall/DeleteFirewallRuleCmd.java       |    2 +-
 .../user/firewall/DeletePortForwardingRuleCmd.java |    2 +-
 .../user/firewall/UpdatePortForwardingRuleCmd.java |    2 +-
 .../api/command/user/iso/AttachIsoCmd.java         |    5 +-
 .../api/command/user/iso/DeleteIsoCmd.java         |    3 +-
 .../api/command/user/iso/DetachIsoCmd.java         |    3 +-
 .../api/command/user/iso/ExtractIsoCmd.java        |    4 +-
 .../api/command/user/iso/RegisterIsoCmd.java       |    2 +-
 .../api/command/user/iso/UpdateIsoCmd.java         |    3 +-
 .../loadbalancer/AssignToLoadBalancerRuleCmd.java  |    3 +-
 .../loadbalancer/CreateLBStickinessPolicyCmd.java  |    5 +-
 .../loadbalancer/CreateLoadBalancerRuleCmd.java    |    7 +-
 .../loadbalancer/DeleteLBStickinessPolicyCmd.java  |    3 +-
 .../loadbalancer/DeleteLoadBalancerRuleCmd.java    |    2 +-
 .../RemoveFromLoadBalancerRuleCmd.java             |    2 +-
 .../loadbalancer/UpdateLoadBalancerRuleCmd.java    |    2 +-
 .../user/nat/CreateIpForwardingRuleCmd.java        |    5 +-
 .../user/nat/DeleteIpForwardingRuleCmd.java        |    3 +-
 .../api/command/user/nat/DisableStaticNatCmd.java  |    3 +-
 .../api/command/user/nat/EnableStaticNatCmd.java   |    5 +-
 .../command/user/network/CreateNetworkACLCmd.java  |    7 +-
 .../api/command/user/network/CreateNetworkCmd.java |    3 +-
 .../command/user/network/DeleteNetworkACLCmd.java  |    3 +-
 .../api/command/user/network/DeleteNetworkCmd.java |    2 +-
 .../command/user/network/RestartNetworkCmd.java    |    2 +-
 .../api/command/user/network/UpdateNetworkCmd.java |    3 +-
 .../command/user/project/ActivateProjectCmd.java   |    2 +-
 .../api/command/user/project/CreateProjectCmd.java |    4 +-
 .../api/command/user/project/DeleteProjectCmd.java |    3 +-
 .../user/project/DeleteProjectInvitationCmd.java   |    3 +-
 .../command/user/project/SuspendProjectCmd.java    |    2 +-
 .../api/command/user/project/UpdateProjectCmd.java |    3 +-
 .../user/project/UpdateProjectInvitationCmd.java   |    2 +-
 .../user/resource/GetCloudIdentifierCmd.java       |    3 +-
 .../user/resource/UpdateResourceCountCmd.java      |    2 +-
 .../user/resource/UpdateResourceLimitCmd.java      |    2 +-
 .../AuthorizeSecurityGroupEgressCmd.java           |    2 +-
 .../AuthorizeSecurityGroupIngressCmd.java          |    5 +-
 .../user/securitygroup/CreateSecurityGroupCmd.java |    3 +-
 .../user/securitygroup/DeleteSecurityGroupCmd.java |    5 +-
 .../RevokeSecurityGroupEgressCmd.java              |    2 +-
 .../RevokeSecurityGroupIngressCmd.java             |    3 +-
 .../command/user/snapshot/CreateSnapshotCmd.java   |    4 +-
 .../user/snapshot/CreateSnapshotPolicyCmd.java     |    2 +-
 .../command/user/snapshot/DeleteSnapshotCmd.java   |    2 +-
 .../user/snapshot/DeleteSnapshotPoliciesCmd.java   |    3 +-
 .../api/command/user/tag/CreateTagsCmd.java        |    3 +-
 .../api/command/user/tag/DeleteTagsCmd.java        |    3 +-
 .../api/command/user/template/CopyTemplateCmd.java |    5 +-
 .../command/user/template/CreateTemplateCmd.java   |    4 +-
 .../command/user/template/DeleteTemplateCmd.java   |    2 +-
 .../command/user/template/ExtractTemplateCmd.java  |    4 +-
 .../command/user/template/RegisterTemplateCmd.java |    5 +-
 .../command/user/template/UpdateTemplateCmd.java   |    3 +-
 .../api/command/user/vm/DeployVMCmd.java           |   16 +-
 .../api/command/user/vm/DestroyVMCmd.java          |    2 +-
 .../api/command/user/vm/RebootVMCmd.java           |    3 +-
 .../api/command/user/vm/ResetVMPasswordCmd.java    |    3 +-
 .../api/command/user/vm/RestoreVMCmd.java          |    3 +-
 .../cloudstack/api/command/user/vm/StartVMCmd.java |    8 +-
 .../cloudstack/api/command/user/vm/StopVMCmd.java  |    2 +-
 .../api/command/user/vm/UpdateVMCmd.java           |    3 +-
 .../api/command/user/vm/UpgradeVMCmd.java          |    2 +-
 .../api/command/user/vmgroup/CreateVMGroupCmd.java |    2 +-
 .../api/command/user/vmgroup/DeleteVMGroupCmd.java |    2 +-
 .../api/command/user/vmgroup/UpdateVMGroupCmd.java |    2 +-
 .../api/command/user/volume/AttachVolumeCmd.java   |    3 +-
 .../api/command/user/volume/CreateVolumeCmd.java   |    5 +-
 .../api/command/user/volume/DeleteVolumeCmd.java   |    3 +-
 .../api/command/user/volume/DetachVolumeCmd.java   |    2 +-
 .../api/command/user/volume/ExtractVolumeCmd.java  |    5 +-
 .../api/command/user/volume/MigrateVolumeCmd.java  |    3 +-
 .../api/command/user/volume/ResizeVolumeCmd.java   |   13 +-
 .../api/command/user/volume/UploadVolumeCmd.java   |    2 +-
 .../api/command/user/vpc/CreateStaticRouteCmd.java |    5 +-
 .../api/command/user/vpc/CreateVPCCmd.java         |   11 +-
 .../api/command/user/vpc/DeleteStaticRouteCmd.java |    2 +-
 .../api/command/user/vpc/DeleteVPCCmd.java         |    6 +-
 .../api/command/user/vpc/RestartVPCCmd.java        |    8 +-
 .../api/command/user/vpc/UpdateVPCCmd.java         |    3 +-
 .../api/command/user/vpn/AddVpnUserCmd.java        |    5 +-
 .../command/user/vpn/CreateRemoteAccessVpnCmd.java |    8 +-
 .../command/user/vpn/CreateVpnConnectionCmd.java   |    8 +-
 .../user/vpn/CreateVpnCustomerGatewayCmd.java      |    3 +-
 .../api/command/user/vpn/CreateVpnGatewayCmd.java  |    3 +-
 .../command/user/vpn/DeleteVpnConnectionCmd.java   |    4 +-
 .../user/vpn/DeleteVpnCustomerGatewayCmd.java      |    2 +-
 .../api/command/user/vpn/DeleteVpnGatewayCmd.java  |    2 +-
 .../api/command/user/vpn/RemoveVpnUserCmd.java     |    5 +-
 .../command/user/vpn/ResetVpnConnectionCmd.java    |    4 +-
 .../user/vpn/UpdateVpnCustomerGatewayCmd.java      |    2 +-
 .../api/command/user/discovery/ListApisCmd.java    |    3 +-
 .../cloud/api/commands/netapp/AssociateLunCmd.java |   27 +-
 .../cloud/api/commands/netapp/CreateLunCmd.java    |   21 +-
 .../commands/netapp/CreateVolumeOnFilerCmd.java    |   49 ++--
 .../api/commands/netapp/CreateVolumePoolCmd.java   |   13 +-
 .../api/commands/netapp/DeleteVolumePoolCmd.java   |    9 +-
 .../cloud/api/commands/netapp/DestroyLunCmd.java   |    9 +-
 .../commands/netapp/DestroyVolumeOnFilerCmd.java   |   20 +-
 .../api/commands/netapp/DissociateLunCmd.java      |    8 +-
 .../com/cloud/api/commands/netapp/ListLunsCmd.java |    7 +-
 .../api/commands/netapp/ListVolumePoolsCmd.java    |    7 +-
 .../api/commands/netapp/ListVolumesOnFilerCmd.java |    8 +-
 .../com/cloud/api/commands/ConfigureSimulator.java |    3 +-
 .../cloud/api/commands/DeleteCiscoNexusVSMCmd.java |    5 +-
 .../api/commands/DisableCiscoNexusVSMCmd.java      |    5 +-
 .../cloud/api/commands/EnableCiscoNexusVSMCmd.java |    2 +-
 .../cloud/api/commands/ListCiscoNexusVSMsCmd.java  |   15 +-
 .../api/commands/AddExternalLoadBalancerCmd.java   |   17 +-
 .../cloud/api/commands/AddF5LoadBalancerCmd.java   |   10 +-
 .../api/commands/ConfigureF5LoadBalancerCmd.java   |    6 +-
 .../commands/DeleteExternalLoadBalancerCmd.java    |   16 +-
 .../api/commands/DeleteF5LoadBalancerCmd.java      |    7 +-
 .../commands/ListF5LoadBalancerNetworksCmd.java    |    5 +-
 .../cloud/api/commands/ListF5LoadBalancersCmd.java |    4 +-
 .../cloud/api/commands/AddExternalFirewallCmd.java |   37 ++--
 .../com/cloud/api/commands/AddSrxFirewallCmd.java  |   13 +-
 .../api/commands/ConfigureSrxFirewallCmd.java      |    9 +-
 .../api/commands/DeleteExternalFirewallCmd.java    |   21 +-
 .../cloud/api/commands/DeleteSrxFirewallCmd.java   |    9 +-
 .../api/commands/ListSrxFirewallNetworksCmd.java   |    6 +-
 .../cloud/api/commands/ListSrxFirewallsCmd.java    |    6 +-
 .../api/commands/AddNetscalerLoadBalancerCmd.java  |   10 +-
 .../ConfigureNetscalerLoadBalancerCmd.java         |    6 +-
 .../commands/DeleteNetscalerLoadBalancerCmd.java   |    7 +-
 .../ListNetscalerLoadBalancerNetworksCmd.java      |    5 +-
 .../commands/ListNetscalerLoadBalancersCmd.java    |    5 +-
 .../cloud/api/commands/AddNiciraNvpDeviceCmd.java  |   22 +-
 .../api/commands/DeleteNiciraNvpDeviceCmd.java     |    7 +-
 .../commands/ListNiciraNvpDeviceNetworksCmd.java   |    5 +-
 .../api/commands/ListNiciraNvpDevicesCmd.java      |    7 +-
 server/src/com/cloud/api/ApiDispatcher.java        |  235 +++------------
 server/src/com/cloud/api/ApiServer.java            |  232 +++++++++------
 server/src/com/cloud/api/ApiServlet.java           |   58 ++--
 .../cloud/api/commands/AddTrafficMonitorCmd.java   |    4 +-
 .../api/commands/DeleteTrafficMonitorCmd.java      |   23 +-
 .../api/commands/GenerateUsageRecordsCmd.java      |    2 +-
 .../src/com/cloud/async/AsyncJobManagerImpl.java   |  158 +++++-----
 .../utils/exception/CSExceptionErrorCode.java      |   32 --
 256 files changed, 1040 insertions(+), 995 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java b/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
index 263f023..1cc20d7 100644
--- a/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
+++ b/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
@@ -145,17 +145,17 @@ public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
         } catch (InsufficientCapacityException ex){
             s_logger.info(ex);
             s_logger.trace(ex);
-            throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
         } catch (ConcurrentOperationException ex) {
             s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
         }
 
         if (result != null) {
             this.setEntityId(result.getId());
             this.setEntityUuid(result.getUuid());
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a Private network");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a Private network");
         }
     }
 
@@ -167,7 +167,7 @@ public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private network");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private network");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
index 8026907..e749f22 100644
--- a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
+++ b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
@@ -84,7 +84,7 @@ public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy console proxy");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy console proxy");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/ApiErrorCode.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiErrorCode.java b/api/src/org/apache/cloudstack/api/ApiErrorCode.java
new file mode 100644
index 0000000..51671cd
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/ApiErrorCode.java
@@ -0,0 +1,59 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api;
+
+/**
+ * Enum class for various API error code used in CloudStack
+ * @author minc
+ *
+ */
+public enum ApiErrorCode {
+
+    MALFORMED_PARAMETER_ERROR(430),
+    PARAM_ERROR(431),
+    UNSUPPORTED_ACTION_ERROR(432),
+    API_LIMIT_EXCEED(429),
+
+    INTERNAL_ERROR(530),
+    ACCOUNT_ERROR(531),
+    ACCOUNT_RESOURCE_LIMIT_ERROR(532),
+    INSUFFICIENT_CAPACITY_ERROR(533),
+    RESOURCE_UNAVAILABLE_ERROR(534),
+    RESOURCE_ALLOCATION_ERROR(534),
+    RESOURCE_IN_USE_ERROR(536),
+    NETWORK_RULE_CONFLICT_ERROR(537);
+
+    private int httpCode;
+
+    private ApiErrorCode(int httpStatusCode){
+        httpCode = httpStatusCode;
+    }
+
+    public int getHttpCode() {
+        return httpCode;
+    }
+
+    public void setHttpCode(int httpCode) {
+        this.httpCode = httpCode;
+    }
+
+    public String toString(){
+        return String.valueOf(this.httpCode);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 3399784..ef72af9 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -81,23 +81,6 @@ public abstract class BaseCmd {
         BOOLEAN, DATE, FLOAT, INTEGER, SHORT, LIST, LONG, OBJECT, MAP, STRING, TZDATE, UUID
     }
 
-    // FIXME: Extract these out into a separate file
-    // Client error codes
-    public static final int MALFORMED_PARAMETER_ERROR = 430;
-    public static final int PARAM_ERROR = 431;
-    public static final int UNSUPPORTED_ACTION_ERROR = 432;
-    public static final int PAGE_LIMIT_EXCEED = 433;
-
-    // Server error codes
-    public static final int INTERNAL_ERROR = 530;
-    public static final int ACCOUNT_ERROR = 531;
-    public static final int ACCOUNT_RESOURCE_LIMIT_ERROR = 532;
-    public static final int INSUFFICIENT_CAPACITY_ERROR = 533;
-    public static final int RESOURCE_UNAVAILABLE_ERROR = 534;
-    public static final int RESOURCE_ALLOCATION_ERROR = 534;
-    public static final int RESOURCE_IN_USE_ERROR = 536;
-    public static final int NETWORK_RULE_CONFLICT_ERROR = 537;
-
     public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
     public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     public static Pattern newInputDateFormat = Pattern.compile("[\\d]+-[\\d]+-[\\d]+ [\\d]+:[\\d]+:[\\d]+");
@@ -230,7 +213,7 @@ public abstract class BaseCmd {
             int arrayStartIndex = key.indexOf('[');
             int arrayStartLastIndex = key.lastIndexOf('[');
             if (arrayStartIndex != arrayStartLastIndex) {
-                throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+                throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
                         + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
             }
 
@@ -239,7 +222,7 @@ public abstract class BaseCmd {
                 int arrayEndLastIndex = key.lastIndexOf(']');
                 if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
                     // malformed parameter
-                    throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+                    throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
                             + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
                 }
 
@@ -247,7 +230,7 @@ public abstract class BaseCmd {
                 int fieldIndex = key.indexOf('.');
                 String fieldName = null;
                 if (fieldIndex < arrayEndIndex) {
-                    throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+                    throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
                             + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
                 } else {
                     fieldName = key.substring(fieldIndex + 1);
@@ -272,7 +255,7 @@ public abstract class BaseCmd {
                 }
 
                 if (!parsedIndex) {
-                    throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+                    throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
                             + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
                 }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
index aacc6ef..3222c71 100644
--- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
@@ -119,7 +119,7 @@ public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update template/iso permissions");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template/iso permissions");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/ServerApiException.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/org/apache/cloudstack/api/ServerApiException.java
index 1f57b74..682e5b7 100644
--- a/api/src/org/apache/cloudstack/api/ServerApiException.java
+++ b/api/src/org/apache/cloudstack/api/ServerApiException.java
@@ -15,28 +15,51 @@
 // specific language governing permissions and limitations
 // under the License.
 package org.apache.cloudstack.api;
+import java.util.ArrayList;
+
+import com.cloud.exception.CloudException;
+import com.cloud.utils.exception.CSExceptionErrorCode;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 @SuppressWarnings("serial")
 public class ServerApiException extends CloudRuntimeException {
-    private int _errorCode;
+    private ApiErrorCode _errorCode;
     private String _description;
 
     public ServerApiException() {
-        _errorCode = 0;
+        _errorCode = ApiErrorCode.INTERNAL_ERROR;
         _description = null;
+        setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ServerApiException.class.getName()));
+    }
+
+    public ServerApiException(ApiErrorCode errorCode, String description) {
+        _errorCode = errorCode;
+        _description = description;
+        setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ServerApiException.class.getName()));
     }
 
-    public ServerApiException(int errorCode, String description) {
+    // wrap a specific CloudRuntimeException to a ServerApiException
+    public ServerApiException(ApiErrorCode errorCode, String description, Throwable cause){
+        super(description, cause);
         _errorCode = errorCode;
         _description = description;
+        if (cause instanceof CloudRuntimeException || cause instanceof CloudException ) {
+            CloudRuntimeException rt = (CloudRuntimeException) cause;
+            ArrayList<String> idList = rt.getIdProxyList();
+            if (idList != null) {
+                for (int i = 0; i < idList.size(); i++) {
+                    addProxyObject(idList.get(i));
+                }
+            }
+            setCSErrorCode(rt.getCSErrorCode());
+        }
     }
 
-    public int getErrorCode() {
+    public ApiErrorCode getErrorCode() {
         return _errorCode;
     }
 
-    public void setErrorCode(int errorCode) {
+    public void setErrorCode(ApiErrorCode errorCode) {
         _errorCode = errorCode;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
index f93787b..a13cf62 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
@@ -151,7 +151,7 @@ public class CreateAccountCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a user account");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user account");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
index a1d9b64..86ccb4b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
@@ -91,7 +91,7 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user account and all corresponding users");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user account and all corresponding users");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
index f0a5e70..318dfda 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
@@ -115,7 +115,7 @@ public class DisableAccountCmd extends BaseAsyncCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" );
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" );
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
index 4aa1e4f..2688ef1 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.account;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -95,7 +96,7 @@ public class EnableAccountCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable account");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable account");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
index 34e9e53..c67e846 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
@@ -84,7 +84,7 @@ public class LockAccountCmd extends BaseCmd {
 //            response.setResponseName(getCommandName());
 //            this.setResponseObject(response);
 //        } else {
-//            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to lock account");
+//            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to lock account");
 //        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
index f134046..ea6d907 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
@@ -22,6 +22,7 @@ import java.util.Map;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -125,7 +126,7 @@ public class UpdateAccountCmd extends BaseCmd{
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update account");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update account");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
index a119d0f..8c98722 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
@@ -20,6 +20,7 @@ package org.apache.cloudstack.api.command.admin.autoscale;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -86,7 +87,7 @@ public class CreateCounterCmd extends BaseAsyncCreateCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Counter with name " + getName());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Counter with name " + getName());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
index 9304eeb..2fde061 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
@@ -20,6 +20,7 @@ package org.apache.cloudstack.api.command.admin.autoscale;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -56,7 +57,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
             result = _autoScaleService.deleteCounter(getId());
         } catch (ResourceInUseException ex) {
             s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
         }
 
         if (result) {
@@ -64,7 +65,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
             this.setResponseObject(response);
         } else {
             s_logger.warn("Failed to delete counter with Id: " + getId());
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete counter.");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete counter.");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
index 28bf72d..c64883c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
@@ -156,7 +156,7 @@ public class AddClusterCmd extends BaseCmd {
                     clusterResponses.add(clusterResponse);
                 }
             } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add cluster");
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add cluster");
             }
 
             response.setResponses(clusterResponses);
@@ -165,10 +165,10 @@ public class AddClusterCmd extends BaseCmd {
             this.setResponseObject(response);
         } catch (DiscoveryException ex) {
             s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
         } catch (ResourceInUseException ex) {
             s_logger.warn("Exception: ", ex);
-            ServerApiException e = new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+            ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
             for (String proxyObj : ex.getIdProxyList()) {
                 e.addProxyObject(proxyObj);
             }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
index f0b40cb..93103d3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.cluster;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -70,7 +71,7 @@ public class DeleteClusterCmd extends BaseCmd {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete cluster");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete cluster");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
index 03b43de..d6ec718 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.cluster;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -112,7 +113,7 @@ public class UpdateClusterCmd extends BaseCmd {
                 clusterResponse.setResponseName(getCommandName());
                 this.setResponseObject(clusterResponse);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update cluster");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update cluster");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
index 79693e7..1c43517 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.config;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -76,7 +77,7 @@ public class UpdateCfgCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update config");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update config");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
index 82880c1..19587f4 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.config;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -86,7 +87,7 @@ public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update hypervisor capabilities");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update hypervisor capabilities");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
index 0e6ae32..61614d1 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
@@ -84,7 +84,7 @@ public class CreateDomainCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create domain");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create domain");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
index 7009e70..3fda960 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
@@ -93,7 +93,7 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete domain");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete domain");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
index cc5926c..607120c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
@@ -83,7 +83,7 @@ public class UpdateDomainCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update domain");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update domain");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
index 0a0a98c..77296c7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
@@ -22,6 +22,7 @@ import java.util.List;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -148,7 +149,7 @@ public class AddHostCmd extends BaseCmd {
                     hostResponses.add(hostResponse);
                 }
             } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add host");
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add host");
             }
 
             response.setResponses(hostResponses);
@@ -157,7 +158,7 @@ public class AddHostCmd extends BaseCmd {
             this.setResponseObject(response);
         } catch (DiscoveryException ex) {
             s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
index 579e286..3bcee81 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
@@ -84,11 +84,11 @@ public class AddSecondaryStorageCmd extends BaseCmd {
                     this.setResponseObject(hostResponse);
                 }
             } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add secondary storage");
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
             }
         } catch (DiscoveryException ex) {
             s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
index 93dca91..8c617c0 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.host;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -104,7 +105,7 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd  {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to cancel host maintenance");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to cancel host maintenance");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
index 5103f98..c2b731b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
@@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.HostResponse;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -84,7 +85,7 @@ public class DeleteHostCmd extends BaseCmd {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete host");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete host");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
index 385e2ae..80b53aa 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.host;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -104,7 +105,7 @@ public class PrepareForMaintenanceCmd extends BaseAsyncCmd {
             response.setResponseName("host");
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare host for maintenance");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to prepare host for maintenance");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
index 99e867b..f42ec4b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.host;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -103,11 +104,11 @@ public class ReconnectHostCmd extends BaseAsyncCmd {
                 response.setResponseName(getCommandName());
                 this.setResponseObject(response);
             } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reconnect host");
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reconnect host");
             }
         } catch (Exception ex) {
             s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
index 9ab2717..c1e374e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
@@ -21,6 +21,7 @@ import java.util.List;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -108,7 +109,7 @@ public class UpdateHostCmd extends BaseCmd {
             this.setResponseObject(hostResponse);
         } catch (Exception e) {
             s_logger.debug("Failed to update host:" + getId(), e);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java
index 3e1d74d..b8f9802 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java
@@ -21,6 +21,7 @@ import java.util.Map;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -74,9 +75,9 @@ public class AddNetworkDeviceCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } catch (InvalidParameterValueException ipve) {
-            throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
         } catch (CloudRuntimeException cre) {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
         }
 
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
index 6d4b962..22802f9 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
@@ -21,6 +21,7 @@ import java.util.List;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -103,7 +104,7 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         }else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider to physical network");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add service provider to physical network");
         }
     }
 
@@ -114,7 +115,7 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
             setEntityId(result.getId());
             setEntityUuid(result.getUuid());
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
index b97f85e..6733a35 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
@@ -225,7 +225,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network offering");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network offering");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
index f56ae7d..1b83a91 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
@@ -21,6 +21,7 @@ import java.util.List;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCreateCmd;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -151,7 +152,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         }else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical network");
         }
     }
 
@@ -162,7 +163,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
             setEntityId(result.getId());
             setEntityUuid(result.getUuid());
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical network entity");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java
index ccd92e1..59db3eb 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.network;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -110,7 +111,7 @@ public class CreateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
             this.setResponseObject(response);
         } catch (Exception e) {
             s_logger.warn("Create storage network IP range failed", e);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java
index 0945124..4d8d18e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.network;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -65,12 +66,12 @@ public class DeleteNetworkDeviceCmd extends BaseCmd {
                 response.setResponseName(getCommandName());
                 this.setResponseObject(response);
             } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network device:" + getId());
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network device:" + getId());
             }
         } catch (InvalidParameterValueException ipve) {
-            throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
         } catch (CloudRuntimeException cre) {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
         }
 
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java
index c13088f..69f24b4 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.network;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -70,7 +71,7 @@ public class DeleteNetworkOfferingCmd extends BaseCmd{
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete service offering");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java
index bc74439..f0d2a12 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java
@@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.admin.network;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -76,14 +77,14 @@ public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd {
                 SuccessResponse response = new SuccessResponse(getCommandName());
                 this.setResponseObject(response);
             } else {
-                throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network service provider");
+                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network service provider");
             }
         } catch (ResourceUnavailableException ex) {
             s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
         }  catch (ConcurrentOperationException ex) {
             s_logger.warn("Exception: ", ex);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java
index 5f86efa..178ccb8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java
@@ -70,7 +70,7 @@ public class DeletePhysicalNetworkCmd extends BaseAsyncCmd {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete physical network");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete physical network");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java
index 1873fc7..5fa26f6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java
@@ -70,7 +70,7 @@ public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd {
             this.setResponseObject(response);
         } catch (Exception e) {
             s_logger.warn("Failed to delete storage network ip range " + getId(), e);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java
index 742ff1f..11e74fb 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.BaseListCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -85,9 +86,9 @@ public class ListNetworkDeviceCmd extends BaseListCmd {
             listResponse.setResponseName(getCommandName());
             this.setResponseObject(listResponse);
         } catch (InvalidParameterValueException ipve) {
-            throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
+            throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
         } catch (CloudRuntimeException cre) {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
index a301ac0..3331d48 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
@@ -23,6 +23,7 @@ import org.apache.cloudstack.api.response.ZoneResponse;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.BaseListCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -100,7 +101,7 @@ public class ListPhysicalNetworksCmd extends BaseListCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         }else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to search for physical networks");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to search for physical networks");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
index 8fcaf49..b5045bb 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
@@ -88,7 +88,7 @@ public class ListStorageNetworkIpRangeCmd extends BaseListCmd {
             this.setResponseObject(response);
         } catch (Exception e) {
             s_logger.warn("Failed to list storage network ip range for rangeId=" + getRangeId() + " podId=" + getPodId() + " zoneId=" + getZoneId());
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
index dc2f309..ca4709d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
@@ -102,7 +102,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network offering");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network offering");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
index b770ea2..d64fd07 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
@@ -21,6 +21,7 @@ import java.util.List;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
@@ -88,7 +89,7 @@ public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         }else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service provider");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service provider");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
index d6d0b92..d49d3c4 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
@@ -96,7 +96,7 @@ public class UpdateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
             this.setResponseObject(response);
         } catch (Exception e) {
             s_logger.warn("Update storage network IP range failed", e);
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
         }
 
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
index 08101dc..6c36306 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
@@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.DomainResponse;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -115,7 +116,7 @@ public class CreateDiskOfferingCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create disk offering");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create disk offering");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
index f93c2a8..54151fe 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
@@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.DomainResponse;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -162,7 +163,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
             response.setResponseName(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create service offering");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create service offering");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
index 85e034f..3f85463 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
@@ -20,6 +20,7 @@ import org.apache.cloudstack.api.response.DiskOfferingResponse;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.Parameter;
@@ -70,7 +71,7 @@ public class DeleteDiskOfferingCmd extends BaseCmd {
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete disk offering");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete disk offering");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/3dabd5fb/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
index d1ea4de..0a8949b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
@@ -68,7 +68,7 @@ public class DeleteServiceOfferingCmd extends BaseCmd{
             SuccessResponse response = new SuccessResponse(getCommandName());
             this.setResponseObject(response);
         } else {
-            throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete service offering");
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering");
         }
     }
 }


Mime
View raw message