Parent: [275b81] (diff)

Child: [3b2afc] (diff)

Download this file

exceptions.py    26 lines (23 with data), 934 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class ForgeError(Exception): pass
class ProjectConflict(ForgeError): pass
class ProjectOverlimitError(ForgeError): pass
class ToolError(ForgeError): pass
class NoSuchProjectError(ForgeError): pass
class NoSuchNeighborhoodError(ForgeError): pass
class MailError(ForgeError): pass
class AddressException(MailError): pass
class NoSuchNBLevelError(ForgeError): pass
class CompoundError(ForgeError):
def __repr__(self):
return '<%s>\n%s\n</%s>' % (
self.__class__.__name__,
'\n'.join(map(repr, self.args)),
self.__class__.__name__)
def format_error(self):
import traceback
parts = [ '<%s>\n' % self.__class__.__name__ ]
for tp,val,tb in self.args:
for line in traceback.format_exception(tp,val,tb):
parts.append(' ' + line)
parts.append('</%s>\n' % self.__class__.__name__ )
return ''.join(parts)