Package entropy :: Module exceptions

Source Code for Module entropy.exceptions

  1  ''' 
  2      # DESCRIPTION: 
  3      # Entropy exceptions class 
  4   
  5      Copyright (C) 2007-2009 Fabio Erculiani 
  6   
  7      structure inspired from portage_exception.py 
  8      Copyright 1998-2004 Gentoo Foundation 
  9      # $Id: portage_exception.py 6885 2007-06-20 05:45:31Z zmedico $ 
 10   
 11      This program is free software; you can redistribute it and/or modify 
 12      it under the terms of the GNU General Public License as published by 
 13      the Free Software Foundation; either version 2 of the License, or 
 14      (at your option) any later version. 
 15   
 16      This program is distributed in the hope that it will be useful, 
 17      but WITHOUT ANY WARRANTY; without even the implied warranty of 
 18      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 19      GNU General Public License for more details. 
 20   
 21      You should have received a copy of the GNU General Public License 
 22      along with this program; if not, write to the Free Software 
 23      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 24  ''' 
 25  # pylint ok 
 26   
27 -class EntropyException(Exception):
28 """General superclass for Entropy exceptions"""
29 - def __init__(self, value):
30 self.value = value[:] 31 Exception.__init__(self)
32
33 - def __str__(self):
34 if isinstance(self.value, basestring): 35 return self.value 36 else: 37 return repr(self.value)
38
39 -class CorruptionError(EntropyException):
40 """Corruption indication"""
41
42 -class CacheCorruptionError(EntropyException):
43 """On-Disk cache Corruption indication"""
44
45 -class InvalidDependString(EntropyException):
46 """An invalid depend string has been encountered"""
47
48 -class InvalidVersionString(EntropyException):
49 """An invalid version string has been encountered"""
50
51 -class SecurityViolation(EntropyException):
52 """An incorrect formatting was passed instead of the expected one"""
53
54 -class IncorrectParameter(EntropyException):
55 """A parameter of the wrong type was passed"""
56
57 -class MissingParameter(EntropyException):
58 """A parameter is required for the action requested but was not passed"""
59
60 -class ParseError(EntropyException):
61 """An error was generated while attempting to parse the request"""
62
63 -class InvalidData(EntropyException):
64 """An incorrect formatting was passed instead of the expected one"""
65
66 -class InvalidDataType(EntropyException):
67 """An incorrect type was passed instead of the expected one"""
68
69 -class RepositoryError(EntropyException):
70 """Cannot open repository database"""
71
72 -class ConnectionError(EntropyException):
73 """Cannot connect to service"""
74
75 -class InterruptError(EntropyException):
76 """Raised to interrupt a thread or process"""
77
78 -class FtpError(EntropyException):
79 """FTP errors"""
80
81 -class SystemDatabaseError(EntropyException):
82 """Cannot open system database"""
83
84 -class SPMError(EntropyException):
85 """Source Package Manager generic errors"""
86
87 -class OnlineMirrorError(EntropyException):
88 """Mirror issue"""
89
90 -class QueueError(EntropyException):
91 """Action queue issue"""
92
93 -class InvalidLocation(EntropyException):
94 """ 95 Data was not found when it was expected to exist or 96 was specified incorrectly 97 """
98
99 -class InvalidAtom(EntropyException):
100 """Atom not properly formatted"""
101
102 -class InvalidPackageSet(EntropyException):
103 """Package set does not exist"""
104
105 -class FileNotFound(InvalidLocation):
106 """A file was not found when it was expected to exist"""
107
108 -class DirectoryNotFound(InvalidLocation):
109 """A directory was not found when it was expected to exist"""
110
111 -class OperationNotPermitted(EntropyException):
112 """An operation was not permitted operating system"""
113
114 -class PermissionDenied(EntropyException):
115 """Permission denied""" 116 from errno import EACCES as errno
117
118 -class ReadOnlyFileSystem(EntropyException):
119 """Read-only file system"""
120
121 -class CommandNotFound(EntropyException):
122 """A required binary was not available or executable"""
123
124 -class LibraryNotFound(EntropyException):
125 """A required library was not available or executable"""
126
127 -class SSLError(EntropyException):
128 """SSL support is not available"""
129
130 -class EntropyPackageException(EntropyException):
131 """Malformed or missing package data"""
132