Package utility :: Module ErrorUtility :: Class ErrorUtility
[show private | hide private]
[frames | no frames]

Class ErrorUtility

Singleton --+
            |
           ErrorUtility


Class used to handle errors in DSheet
Method Summary
  __init__(self, output, testing)
ErrorUtility's constructor.
  exceptionRaised(self, exception, level)
Handles an exception to be raised.
  register(self, client)
Register a client to the notify list
    Accessors
  setTesting(self)
Set testing mode.
  setOutput(self, output)
Set the output stream onto which error messages are written.
  unsetTesting(self)
Unset testing mode
  getOutput(self)
Get the output stream

Class Variable Summary
ErrorUtility _ErrorUtility__instance = <utility.ErrorUtility.ErrorUti...
    Accessors
Callable getInstance = <utility.ErrorUtility.Callable instance at...

Method Details

setOutput(self, output)

Set the output stream onto which error messages are written.

setTesting(self)

Set testing mode. Exceptions are now raised directly instead of being simply logged. This allows tests for failures in PyUnit (assertRaises(x)).

unsetTesting(self)

Unset testing mode

getOutput(self)

Get the output stream

__init__(self, output=<epydoc.imports._DevNull instance at 0xf6fb2a8c>, testing=False)
(Constructor)

ErrorUtility's constructor.
Parameters:
output - stream where error messages are written
           (type=stream)
testing - set to true if we are currently testing DSheet, so that exceptions are raised.
           (type=bool)
Overrides:
utility.Singleton.Singleton.__init__

exceptionRaised(self, exception, level=2)

Handles an exception to be raised. If the level is FATAL, send a handleError() to the registered clients so that they can perform backup actions before the applications ends. If the level is not FATAL (LOG,WARNING), the error is simply written to the output stream.
Parameters:
exception - Exception to be raised
           (type=Exception)
level - level of the error (LOG, WARNING, FATAL)
           (type=int (LOG, WARNING, FATAL))
Raises:
ValueError - If level is unknown

Requires: level==LOG or level==WARNING or level==FATAL

register(self, client)

Register a client to the notify list
Parameters:
client - Any object implementing the function handleError
           (type=Object)

Class Variable Details

getInstance

Type:
Callable
Value:
<utility.ErrorUtility.Callable instance at 0xf6fc004c>                 

_ErrorUtility__instance

Type:
ErrorUtility
Value:
<utility.ErrorUtility.ErrorUtility instance at 0xf6fbcc4c>             

Generated by Epydoc 2.1 on Tue Aug 17 18:20:06 2004 http://epydoc.sf.net