summaryrefslogtreecommitdiffstats
path: root/src/software/openlmi/software/yumdb/errors.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/software/openlmi/software/yumdb/errors.py')
-rw-r--r--src/software/openlmi/software/yumdb/errors.py56
1 files changed, 48 insertions, 8 deletions
diff --git a/src/software/openlmi/software/yumdb/errors.py b/src/software/openlmi/software/yumdb/errors.py
index 35dad14..2d9f0e5 100644
--- a/src/software/openlmi/software/yumdb/errors.py
+++ b/src/software/openlmi/software/yumdb/errors.py
@@ -23,29 +23,69 @@
Exceptions raisable by YumWorker.
"""
-class DatabaseLockError(Exception):
+class YumDBError(Exception):
+ """Base class for all errors under yumdb package."""
+
+class DatabaseLockError(YumDBError):
"""Raised, when the yum database can not be locked."""
pass
-class TransactionError(Exception):
+
+class TransactionError(YumDBError):
"""Base exception representing yum transaction processing error."""
pass
class TransactionBuildFailed(TransactionError):
"""Raised, when transaction building fails."""
pass
+class PackageAlreadyInstalled(TransactionError):
+ """Raised, when trying to install already installed package."""
+ def __init__(self, pkg):
+ TransactionError.__init__(self,
+ 'Package "%s" is already installed.' % pkg)
+class PackageOpenError(TransactionError):
+ """Raised, when trying to open package obtained from URI."""
+ def __init__(self, pkg, msg):
+ TransactionError.__init__(self,
+ 'Failed to open package "%s": %s' % (pkg, msg))
class TransactionExecutionFailed(TransactionError):
"""Raised, when YumBase.doTransaction() method fails."""
pass
-class UnknownJob(Exception):
- """Raised, when no handler is available for given job on worker."""
+
+class PackageError(YumDBError):
pass
-class PackageNotFound(Exception):
+class PackageNotFound(PackageError):
"""Raised, when requested package could not be found."""
pass
-class RepositoryNotFound(Exception):
+class PackageNotInstalled(PackageError):
+ """Raised, when requested package is not installed for desired action."""
+ def __init__(self, pkg):
+ PackageError.__init__(self, 'Package "%s" is not installed.' % pkg)
+
+class RepositoryError(YumDBError):
+ pass
+class RepositoryNotFound(RepositoryError):
"""Raised, when requested repository cound not be found."""
def __init__(self, repoid):
- Exception.__init__(self, "No such repository: %s" % repoid)
-class RepositoryChangeError(Exception):
+ RepositoryError.__init__(self, "No such repository: %s" % repoid)
+class RepositoryChangeError(RepositoryError):
"""Raised, when modification of repository failed."""
pass
+class JobError(YumDBError):
+ pass
+class UnknownJob(JobError):
+ """Raised, when no handler is available for given job on worker."""
+ pass
+class InvalidURI(JobError):
+ """Raised, when passed uri is not a valid one."""
+ def __init__(self, uri):
+ JobError.__init__(self, "Invalid uri: \"%s\"" % uri)
+class InvalidNevra(JobError):
+ pass
+class JobControlError(JobError):
+ pass
+class JobNotFound(JobControlError):
+ def __init__(self, target):
+ JobControlError.__init__(self, "job %s could not be found" % target)
+class InvalidJobState(JobControlError):
+ pass
+