After adding prepareTransaction & helpers to YumBase a YumBaseError exception is raised if any thing goes wrong. but i would be nice to see, if it was Download or GPGCheck or TestTransaction there went wrong. So i have created a patch with some extra Yum Exception and make the different step cast a custom exception. Just want to know if the naming look sane, before committing.
Tim
diff --git a/yum/Errors.py b/yum/Errors.py index 22902bf..0f87079 100644 --- a/yum/Errors.py +++ b/yum/Errors.py @@ -25,6 +25,9 @@ class YumBaseError(exceptions.Exception): self.value = value def __str__(self): return "%s" %(self.value,) + +YumDownloadError = YumGPGCheckError = YumTestTransactionError =\ + YumRPMCheckError= YumBaseError class LockError(YumBaseError): def __init__(self, errno, msg): 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
_______________________________________________ Yum-devel mailing list Yum-devel@linux.duke.edu https://lists.dulug.duke.edu/mailman/listinfo/yum-devel