Package entropy :: Module exceptions

Source Code for Module entropy.exceptions

  1  # -*- coding: utf-8 -*- 
  2  """ 
  3   
  4      @author: Fabio Erculiani <lxnay@sabayonlinux.org> 
  5      @contact: lxnay@sabayonlinux.org 
  6      @copyright: Fabio Erculiani 
  7      @license: GPL-2 
  8   
  9      B{Entropy Framework exceptions class module} 
 10   
 11      This module contains Entropy Framework exceptions classes. 
 12   
 13  """ 
 14  from entropy.const import const_isstring, const_convert_to_unicode 
 15   
16 -class DumbException(Exception):
17 """Dumb exception class"""
18
19 -class EntropyException(Exception):
20 """General superclass for Entropy exceptions"""
21 - def __init__(self, value):
22 self.value = value 23 Exception.__init__(self)
24
25 - def __unicode__(self):
26 if const_isstring(self.value): 27 return const_convert_to_unicode(self.value) 28 return const_convert_to_unicode(repr(self.value))
29
30 - def __str__(self):
31 if const_isstring(self.value): 32 return self.value 33 return repr(self.value)
34
35 -class CorruptionError(EntropyException):
36 """Corruption indication"""
37
38 -class CacheCorruptionError(EntropyException):
39 """On-Disk cache Corruption indication"""
40
41 -class InvalidDependString(EntropyException):
42 """An invalid depend string has been encountered"""
43
44 -class DependenciesNotFound(EntropyException):
45 """ 46 During dependencies calculation, dependencies were not found, 47 list (set) of missing dependencies are in the .value attribute 48 """
49
50 -class InvalidVersionString(EntropyException):
51 """An invalid version string has been encountered"""
52
53 -class SecurityViolation(EntropyException):
54 """An incorrect formatting was passed instead of the expected one"""
55
56 -class IncorrectParameter(EntropyException):
57 """A parameter of the wrong type was passed"""
58
59 -class MissingParameter(EntropyException):
60 """A parameter is required for the action requested but was not passed"""
61
62 -class ParseError(EntropyException):
63 """An error was generated while attempting to parse the request"""
64
65 -class InvalidData(EntropyException):
66 """An incorrect formatting was passed instead of the expected one"""
67
68 -class InvalidDataType(EntropyException):
69 """An incorrect type was passed instead of the expected one"""
70
71 -class RepositoryError(EntropyException):
72 """Cannot open repository database"""
73
74 -class EntropyRepositoryError(EntropyException):
75 """ An Entropy-related error occured in EntropyRepository class methods """
76
77 -class RepositoryPluginError(EntropyException):
78 """Error during EntropyRepositoryPlugin hook execution"""
79
80 -class ConnectionError(EntropyException):
81 """Cannot connect to service"""
82
83 -class InterruptError(EntropyException):
84 """Raised to interrupt a thread or process"""
85
86 -class UriHandlerNotFound(EntropyException):
87 """ 88 Raised when URI handler (in entropy.transceivers.EntropyTransceiver) 89 for given URI is not available. 90 """
91
92 -class TransceiverError(EntropyException):
93 """FTP errors"""
94
95 -class SystemDatabaseError(EntropyException):
96 """Cannot open system database"""
97
98 -class SPMError(EntropyException):
99 """Source Package Manager generic errors"""
100
101 -class OnlineMirrorError(EntropyException):
102 """Mirror issue"""
103
104 -class QueueError(EntropyException):
105 """Action queue issue"""
106
107 -class InvalidLocation(EntropyException):
108 """ 109 Data was not found when it was expected to exist or 110 was specified incorrectly 111 """
112
113 -class InvalidAtom(EntropyException):
114 """Atom not properly formatted"""
115
116 -class InvalidPackageSet(EntropyException):
117 """Package set does not exist"""
118
119 -class FileNotFound(InvalidLocation):
120 """A file was not found when it was expected to exist"""
121
122 -class DirectoryNotFound(InvalidLocation):
123 """A directory was not found when it was expected to exist"""
124
125 -class OperationNotPermitted(EntropyException):
126 """An operation was not permitted operating system"""
127
128 -class PermissionDenied(EntropyException):
129 """Permission denied""" 130 from errno import EACCES as errno
131
132 -class ReadOnlyFileSystem(EntropyException):
133 """Read-only file system"""
134
135 -class CommandNotFound(EntropyException):
136 """A required binary was not available or executable"""
137
138 -class LibraryNotFound(EntropyException):
139 """A required library was not available or executable"""
140
141 -class SSLError(EntropyException):
142 """SSL support is not available"""
143
144 -class TimeoutError(EntropyException):
145 """Generic Timeout Error exception"""
146
147 -class EntropyPackageException(EntropyException):
148 """Malformed or missing package data"""
149