Package entropy :: Module exceptions

Source Code for Module entropy.exceptions

  1  # -*- coding: utf-8 -*- 
  2  """ 
  3   
  4      @author: Fabio Erculiani <[email protected]> 
  5      @contact: [email protected] 
  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 SecurityError(EntropyException):
36 """ Security related error """
37
38 -class CorruptionError(EntropyException):
39 """Corruption indication"""
40
41 -class CacheCorruptionError(EntropyException):
42 """On-Disk cache Corruption indication"""
43
44 -class InvalidDependString(EntropyException):
45 """An invalid depend string has been encountered"""
46
47 -class DependenciesNotFound(EntropyException):
48 """ 49 During dependencies calculation, dependencies were not found, 50 list (set) of missing dependencies are in the .value attribute 51 """
52
53 -class DependenciesCollision(EntropyException):
54 """ 55 During dependencies calculation, dependencies were pulled in in the same 56 "scope" (package key + package slot), 57 two-element tuple of: 58 list of lists (set) of colliding dependencies are in the .value attribute, 59 dictionary mapping dependency to its (first level) reverse dependency 60 """
61
62 -class DependenciesNotRemovable(EntropyException):
63 """ 64 During dependencies calculation, dependencies got considered 65 vital for system health. 66 """
67
68 -class RepositoryError(EntropyException):
69 """Cannot open repository database"""
70
71 -class RepositoryPluginError(EntropyException):
72 """Error during EntropyRepositoryPlugin hook execution"""
73
74 -class InterruptError(EntropyException):
75 """Raised to interrupt a thread or process"""
76
77 -class SystemDatabaseError(EntropyException):
78 """Cannot open system database"""
79
80 -class SPMError(EntropyException):
81 """Source Package Manager generic errors"""
82
83 -class OnlineMirrorError(EntropyException):
84 """Mirror issue"""
85
86 -class QueueError(EntropyException):
87 """Action queue issue"""
88
89 -class InvalidAtom(EntropyException):
90 """Atom not properly formatted"""
91
92 -class InvalidPackageSet(EntropyException):
93 """Package set does not exist"""
94
95 -class FileNotFound(EntropyException):
96 """A file was not found when it was expected to exist"""
97
98 -class DirectoryNotFound(EntropyException):
99 """A directory was not found when it was expected to exist"""
100
101 -class OperationNotPermitted(EntropyException):
102 """An operation was not permitted operating system"""
103
104 -class PermissionDenied(EntropyException):
105 """Permission denied""" 106 from errno import EACCES as errno
107
108 -class LibraryNotFound(EntropyException):
109 """A required library was not available or executable"""
110
111 -class EntropyPackageException(EntropyException):
112 """Malformed or missing package data"""
113