Dela via


CATCH_ALL

Defines a block of code that catches all exception types thrown in the preceding TRY block.

CATCH_ALL(exception_object_pointer_name )

Parameters

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

Remarks

The exception-processing code can interrogate the exception object, if appropriate, to get more information about the specific cause of the exception. Invoke the THROW_LAST macro to shift processing to the next outer exception frame. If you use CATCH_ALL, end the TRY block with an END_CATCH_ALL macro.

Note

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

For more information on exceptions, see the article Exceptions.

Example

See the example for CFile::Abort.

Requirements

Header: afx.h

See Also

Concepts

MFC Macros and Globals

Reference

TRY

AND_CATCH_ALL

END_CATCH

THROW (MFC)

THROW_LAST

CATCH

CException Class