Package grizzled :: Module exception :: Class ExceptionWithMessage
[frames] | no frames]

Class ExceptionWithMessage

              object --+        
                       |        
exceptions.BaseException --+    
                           |    
        exceptions.Exception --+
                               |
                              ExceptionWithMessage

Useful base class for exceptions that have a single exception message argument. Among other things, this method provides a reasonable default __str__() method.

Usage:

from grizzled.exception import ExceptionWithMessage

class MyException(ExceptionWithMessage):
    def __init__(self, msg):
        ExceptionWithMessage.__init__(self, msg)
Instance Methods
 
__init__(self, errorMessage)
Create a new exception.
 
message(self)
The message stored with this object.
 
__str__(self)
str(x)

Inherited from exceptions.Exception: __new__

Inherited from exceptions.BaseException: __delattr__, __getattribute__, __getitem__, __getslice__, __reduce__, __repr__, __setattr__, __setstate__

Inherited from object: __hash__, __reduce_ex__

Properties

Inherited from exceptions.BaseException: args

Inherited from object: __class__

Method Details

__init__(self, errorMessage)
(Constructor)

 

Create a new exception.

@type errorMessage: string @param errorMessage: the error message

Overrides: object.__init__

message(self)

 
The message stored with this object.
Decorators:
  • @property
Overrides: message

__str__(self)
(Informal representation operator)

 
str(x)
Overrides: object.__str__
(inherited documentation)