Partager via


AND_CATCH

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

AND_CATCH(exception_class, exception_object_pointer_name )

Paramètres

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

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

Notes

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.

Notes

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.

Exemple

See the example for CATCH.

Configuration requise

Header: afx.h

Voir aussi

Référence

ESSAI

CATCH

END_CATCH

JET (MFC)

THROW_LAST

AND_CATCH_ALL

CException, classe

Concepts

macro MFC et Globals