From 8069a45a26285d9fc03b2910d34200783c786dd9 Mon Sep 17 00:00:00 2001 From: kishan Date: Mon, 11 Jul 2011 14:09:13 +0530 Subject: [PATCH] bug 10276: Throw exception for account APIs failure status 10276: resolved fixed --- server/src/com/cloud/event/ActionEventCallback.java | 11 +++++++++-- server/src/com/cloud/user/AccountManagerImpl.java | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/event/ActionEventCallback.java b/server/src/com/cloud/event/ActionEventCallback.java index db6a8552396..d12fc7bf239 100644 --- a/server/src/com/cloud/event/ActionEventCallback.java +++ b/server/src/com/cloud/event/ActionEventCallback.java @@ -31,11 +31,18 @@ public class ActionEventCallback implements MethodInterceptor, AnnotationInterce @Override public Object intercept(Object object, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { - EventVO event = interceptStart(method);; + EventVO event = interceptStart(method); + boolean success = true; try { return methodProxy.invokeSuper(object, args); + } catch (Exception e){ + success = false; + interceptException(method, event); + return null; } finally { - interceptComplete(method, event); + if(success){ + interceptComplete(method, event); + } } } diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index 299405970f0..dab1b8cd2d7 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -1636,7 +1636,10 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag return true; } - return deleteAccount(account, callerUserId, caller); + if(!deleteAccount(account, callerUserId, caller)){ + throw new CloudRuntimeException("Unable to delete account " + account.getAccountName() + " in domain " + account.getDomainId()); + } + return true; } @Override