summaryrefslogtreecommitdiffstats
path: root/pym/cache/cache_errors.py
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gentoo.org>2005-11-05 06:09:45 +0000
committerBrian Harring <ferringb@gentoo.org>2005-11-05 06:09:45 +0000
commit6972e5da0cbda080c1cfd2c07eedb2298fa9c0b9 (patch)
treef60b85ea28fe1fb69ee1e6ed614cfa6e7fbcc8f0 /pym/cache/cache_errors.py
parent202c0acb0b68acd88b96cacf8f296b9892642423 (diff)
downloadportage-6972e5da0cbda080c1cfd2c07eedb2298fa9c0b9.tar.gz
portage-6972e5da0cbda080c1cfd2c07eedb2298fa9c0b9.tar.bz2
portage-6972e5da0cbda080c1cfd2c07eedb2298fa9c0b9.zip
replacement cache subsystem that's gestated in 2.1 and 3.0.
it rocks your world, baby. svn path=/main/branches/2.0/; revision=2257
Diffstat (limited to 'pym/cache/cache_errors.py')
-rw-r--r--pym/cache/cache_errors.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/pym/cache/cache_errors.py b/pym/cache/cache_errors.py
new file mode 100644
index 000000000..2f5b831bf
--- /dev/null
+++ b/pym/cache/cache_errors.py
@@ -0,0 +1,41 @@
+# Copyright: 2005 Gentoo Foundation
+# Author(s): Brian Harring (ferringb@gentoo.org)
+# License: GPL2
+# $Id: cache_errors.py 1911 2005-08-25 03:44:21Z ferringb $
+
+class CacheError(Exception): pass
+
+class InitializationError(CacheError):
+ def __init__(self, class_name, error):
+ self.error, self.class_name = error, class_name
+ def __str__(self):
+ return "Creation of instance %s failed due to %s" % \
+ (self.class_name, str(self.error))
+
+
+class CacheCorruption(CacheError):
+ def __init__(self, key, ex):
+ self.key, self.ex = key, ex
+ def __str__(self):
+ return "%s is corrupt: %s" % (self.key, str(self.ex))
+
+
+class GeneralCacheCorruption(CacheError):
+ def __init__(self,ex): self.ex = ex
+ def __str__(self): return "corruption detected: %s" % str(self.ex)
+
+
+class InvalidRestriction(CacheError):
+ def __init__(self, key, restriction, exception=None):
+ if exception == None: exception = ''
+ self.key, self.restriction, self.ex = key, restriction, ex
+ def __str__(self):
+ return "%s:%s is not valid: %s" % \
+ (self.key, self.restriction, str(self.ex))
+
+
+class ReadOnlyRestriction(CacheError):
+ def __init__(self, info=''):
+ self.info = info
+ def __str__(self):
+ return "cache is non-modifiable"+str(self.info)