共用方式為


AND_CATCH_ALL

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

AND_CATCH_ALL(exception_object_pointer_name )

Parameters

  • exception_object_pointer_name
    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_ALL block. This variable is declared for you.

Remarks

Use the CATCH macro to catch one exception type, then the AND_CATCH_ALL macro to catch all other subsequent types. If you use AND_CATCH_ALL, end the TRY block with an END_CATCH_ALL 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_ALL block to shift processing to the next outer exception frame. AND_CATCH_ALL marks the end of the preceding CATCH or AND_CATCH_ALL block.

注意

The AND_CATCH_ALL block is defined as a C++ scope (delineated by braces). If you declare variables in this scope, remember that they are accessible only within that scope.

Requirements

Header: afx.h

See Also

Concepts

MFC Macros and Globals

TRY

CATCH_ALL

END_CATCH_ALL

THROW (MFC)

THROW_LAST

AND_CATCH

CException Class