Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.error.CompositeError Class Reference
Inheritance diagram for MoinMoin.error.CompositeError:
Inheritance graph
Collaboration diagram for MoinMoin.error.CompositeError:
Collaboration graph

List of all members.

Public Member Functions

def __init__
def exceptions
def __unicode__
def __str__
def __getitem__

Public Attributes


Detailed Description

Base class for exceptions containing an exception

Do not use this class but its more specific sub classes.

Useful for hiding low level error inside high level user error,
while keeping the inner error information for debugging.


    class InternalError(CompositeError):
        ''' Raise for internal errors '''

        # code that might fail...
    except HairyLowLevelError:
        raise InternalError("Sorry, internal error occurred")

When showing a traceback, both InternalError traceback and
HairyLowLevelError traceback are available.

Definition at line 58 of file

Constructor & Destructor Documentation

def MoinMoin.error.CompositeError.__init__ (   self,
Save system exception info before this exception is raised 

Reimplemented from MoinMoin.error.Error.

Definition at line 80 of file

00081     def __init__(self, message):
00082         """ Save system exception info before this exception is raised """
00083         Error.__init__(self, message)
00084         self.innerException = sys.exc_info()

Member Function Documentation

def MoinMoin.error.Error.__getitem__ (   self,
) [inherited]
Make it possible to access attributes like a dict 

Definition at line 53 of file

00054     def __getitem__(self, item):
00055         """ Make it possible to access attributes like a dict """
00056         return getattr(self, item)

Here is the caller graph for this function:

def MoinMoin.error.Error.__str__ (   self) [inherited]
Return encoded message 

Definition at line 46 of file

00047     def __str__(self):
00048         """ Return encoded message """
00049         if isinstance(self.message, unicode):
00050             return self.message.encode(config.charset)
00051         else:
00052             return str(self.message)

def MoinMoin.error.Error.__unicode__ (   self) [inherited]
Return unicode error message 

Definition at line 39 of file

00040     def __unicode__(self):
00041         """ Return unicode error message """
00042         if isinstance(self.message, str):
00043             return unicode(self.message, config.charset)
00044         else:
00045             return unicode(self.message)

Return a list of all inner exceptions 

Definition at line 85 of file

00086     def exceptions(self):
00087         """ Return a list of all inner exceptions """
00088         all = [self.innerException]
00089         while 1:
00090             lastException = all[-1][1]
00091             try:
00092                 all.append(lastException.innerException)
00093             except AttributeError:
00094                 break
00095         return all

Member Data Documentation

Definition at line 83 of file

Definition at line 37 of file

The documentation for this class was generated from the following file: