[Kimchi-devel] [PATCH 05/10] bug fix: Raise exception comming from backend
Aline Manera
alinefm at linux.vnet.ibm.com
Tue Mar 18 17:04:10 UTC 2014
From: Aline Manera <alinefm at br.ibm.com>
The backend has a more detailed information when a problem occurs, so
raise this exception instead of get it and raise a generic error message
"Unable to update repository", "Unable to create repository" and so
Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
src/kimchi/model/host.py | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/kimchi/model/host.py b/src/kimchi/model/host.py
index b195a97..e5b6132 100644
--- a/src/kimchi/model/host.py
+++ b/src/kimchi/model/host.py
@@ -359,25 +359,19 @@ class RepositoryModel(object):
if self._repositories is None:
raise InvalidOperation('KCHREPOS0014E')
- if not self._repositories.enableRepository(repo_id):
- raise OperationFailed("KCHREPOS0007E", {'repo_id': repo_id})
+ return self._repositories.enableRepository(repo_id)
def disable(self, repo_id):
if self._repositories is None:
raise InvalidOperation('KCHREPOS0014E')
- if not self._repositories.disableRepository(repo_id):
- raise OperationFailed("KCHREPOS0008E", {'repo_id': repo_id})
+ return self._repositories.disableRepository(repo_id)
def update(self, repo_id, params):
if self._repositories is None:
raise InvalidOperation('KCHREPOS0014E')
- try:
- self._repositories.updateRepository(repo_id, params)
- except:
- raise OperationFailed("KCHREPOS0009E", {'repo_id': repo_id})
- return repo_id
+ return self._repositories.updateRepository(repo_id, params)
def delete(self, repo_id):
if self._repositories is None:
--
1.7.10.4
More information about the Kimchi-devel
mailing list