Adding a new exception class.
[portage.git] / pym / portage_exception.py
1 # Copyright 1998-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id: /var/cvsroot/gentoo-src/portage/pym/portage_exception.py,v 1.8.2.1 2005/01/16 02:35:33 carpaski Exp $
4
5
6 class PortageException(Exception):
7         """General superclass for portage exceptions"""
8         def __init__(self,value):
9                 self.value = value[:]
10         def __str__(self):
11                 return repr(self.value)
12
13 class CorruptionError(PortageException):
14         """Corruption indication"""
15
16 class InvalidDependString(PortageException):
17         """An invalid depend string has been encountered"""
18
19 class InvalidVersionString(PortageException):
20         """An invalid version string has been encountered"""
21
22 class SecurityViolation(PortageException):
23         """An incorrect formatting was passed instead of the expected one"""
24
25 class IncorrectParameter(PortageException):
26         """A parameter of the wrong type was passed"""
27
28 class MissingParameter(PortageException):
29         """A parameter is required for the action requested but was not passed"""
30
31 class ParseError(PortageException):
32         """An error was generated while attempting to parse the request"""
33
34 class InvalidData(PortageException):
35         """An incorrect formatting was passed instead of the expected one"""
36
37 class InvalidDataType(PortageException):
38         """An incorrect type was passed instead of the expected one"""
39
40 class InvalidLocation(PortageException):
41         """Data was not found when it was expected to exist or was specified incorrectly"""
42
43 class FileNotFound(InvalidLocation):
44         """A file was not found when it was expected to exist"""
45
46 class DirectoryNotFound(InvalidLocation):
47         """A directory was not found when it was expected to exist"""
48
49
50 class CommandNotFound(PortageException):
51         """A required binary was not available or executable"""
52
53
54 class PortagePackageException(PortageException):
55         """Malformed or missing package data"""
56
57 class PackageNotFound(PortagePackageException):
58         """Missing Ebuild or Binary"""
59
60 class InvalidPackageName(PortagePackageException):
61         """Malformed package name"""
62
63 class InvalidAtom(PortagePackageException):
64         """Malformed atom spec"""
65
66 class UnsupportedAPIException(PortagePackageException):
67         """Unsupported API"""
68         def __init__(self, cpv, api):
69                 self.cpv, self.api = cpv, api
70         def __str__(self):
71                 return "Unable to do any operations on '%s', due to the fact it's EAPI is higher then this portage versions.  Please upgrade to a portage version that supports EAPI %s" % (self.cpv, self.eapi)
72
73
74
75 class SignatureException(PortageException):
76         """Signature was not present in the checked file"""
77
78 class DigestException(SignatureException):
79         """A problem exists in the digest"""
80
81 class MissingSignature(SignatureException):
82         """Signature was not present in the checked file"""
83
84 class InvalidSignature(SignatureException):
85         """Signature was checked and was not a valid, current, nor trusted signature"""
86
87 class UntrustedSignature(SignatureException):
88         """Signature was not certified to the desired security level"""
89