This documentation is archived and is not being maintained.


Defines a block of code for catching additional exception types thrown in a preceding TRY block.

AND_CATCH(exception_class, exception_object_pointer_name )


Specifies the exception type to test for. For a list of standard exception classes, see class CException.


A name for an exception-object pointer that will be created by the macro. You can use the pointer name to access the exception object within the AND_CATCH block. This variable is declared for you.

Use the CATCH macro to catch one exception type, then the AND_CATCH macro to catch each subsequent type. End the TRY block with an END_CATCH macro.

The exception-processing code can interrogate the exception object, if appropriate, to get more information about the specific cause of the exception. Call the THROW_LAST macro within the AND_CATCH block to shift processing to the next outer exception frame. AND_CATCH marks the end of the preceding CATCH or AND_CATCH block.


The AND_CATCH block is defined as a C++ scope (delineated by curly braces). If you declare variables in this scope, remember that they are accessible only within that scope. This also applies to the exception_object_pointer_name variable.

See the example for CATCH.

Header: afx.h