[yum-cvs] yum/Errors.py yum/__init__.py
Tim Lauridsen
timlau at linux.duke.edu
Mon Aug 20 16:53:40 UTC 2007
yum/Errors.py | 20 ++++++++++++++++++++
yum/__init__.py | 8 ++++----
2 files changed, 24 insertions(+), 4 deletions(-)
New commits:
commit b51ea183248758ca2317126d61e3e97cf31a31be
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Mon Aug 20 18:52:11 2007 +0200
Added some extra yum exeption and made the processTransaction helper functions cast distinct Exception, to make it easier for the API users to distinguish between the exceptions.
diff --git a/yum/Errors.py b/yum/Errors.py
index 22902bf..d2472aa 100644
--- a/yum/Errors.py
+++ b/yum/Errors.py
@@ -26,6 +26,26 @@ class YumBaseError(exceptions.Exception):
def __str__(self):
return "%s" %(self.value,)
+class YumGPGCheckError(YumBaseError):
+ def __init__(self, value=None):
+ YumBaseError.__init__(self)
+ self.value = value
+
+class YumDownloadError(YumBaseError):
+ def __init__(self, value=None):
+ YumBaseError.__init__(self)
+ self.value = value
+
+class YumTestTransactionError(YumBaseError):
+ def __init__(self, value=None):
+ YumBaseError.__init__(self)
+ self.value = value
+
+class YumRPMCheckError(YumBaseError):
+ def __init__(self, value=None):
+ YumBaseError.__init__(self)
+ self.value = value
+
class LockError(YumBaseError):
def __init__(self, errno, msg):
YumBaseError.__init__(self)
diff --git a/yum/__init__.py b/yum/__init__.py
index ec0ee1b..377fd0f 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2219,7 +2219,7 @@ class YumBase(depsolve.Depsolve):
for error in errors:
errstr.append("%s: %s" %(key, error))
- raise yum.Errors.YumBaseError, errstr
+ raise yum.Errors.YumDownloadError, errstr
return dlpkgs
def _checkSignatures(self,pkgs):
@@ -2233,7 +2233,7 @@ class YumBase(depsolve.Depsolve):
elif result == 1:
self.getKeyForPackage(po, self._askForGPGKeyImport)
else:
- raise yum.Errors.YumBaseError, errmsg
+ raise yum.Errors.YumGPGCheckError, errmsg
return 0
@@ -2255,7 +2255,7 @@ class YumBase(depsolve.Depsolve):
retmsgs = ['ERROR with rpm_check_debug vs depsolve:']
retmsgs.extend(msgs)
retmsgs.append('Please report this error in bugzilla')
- raise yum.Errors.YumBaseError,retmsgs
+ raise yum.Errors.YumRPMCheckError,retmsgs
tsConf = {}
for feature in ['diskspacecheck']: # more to come, I'm sure
@@ -2280,7 +2280,7 @@ class YumBase(depsolve.Depsolve):
errstring = 'Test Transaction Errors: '
for descr in tserrors:
errstring += ' %s\n' % descr
- raise yum.Errors.YumBaseError, errstring
+ raise yum.Errors.YumTestTransactionError, errstring
del self.ts
# put back our depcheck callback
More information about the Yum-cvs-commits
mailing list