template class ExceptionHandler<class E> : CallGate

Calls a handler function when an exception is caught.

The exception handler template generates CallGates that catch an exception of type E and call a handler function as result. The handler function could then decide what to do (i.e. throw a TestFailure or TestError). An exception handler can be useful when many different unit test must handle the same exception type while executing the test. Instead of writing try-catch-blocks in every unit test, an exception handler could be registered in the test conductor (see also TestManager).



Public Members:
    ExceptionHandler ( handler_func handler, Callable* target = 0, bool release = true ) ;
    Create an exception handler instance.
    Beside the handler function, the call target and its release status could be set. If the trap is used by a TestManager, the manager sets the target.

    ExceptionHandler ( const ExceptionHandler& eh ) ;
    Copy-constructor
    Create another, identical exception handler.

    virtual void call () ;
    Calls the call target.
    While doing that, the handler catches exceptions of type E. If that happens, it calls the handler function.




The Scrunitizer C++ Unit Test Framework
by Bernd Linowski

[Scrunitizer]  [Overview]  [Cookbook]  [Download]  [Index]  [Linosphere]

Page generated: 1 Nov 2000
(C) by Bernd Linowski
scrunitizer@linosphere.de