OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    Standard_DefineException.hxx File Reference
    #include <Standard_SStream.hxx>
    #include <memory>

    Macros

    #define DEFINE_STANDARD_EXCEPTION(C1, C2)
     Defines an exception class inheriting from Standard_Failure.

    Macro Definition Documentation

    ◆ DEFINE_STANDARD_EXCEPTION

    #define DEFINE_STANDARD_EXCEPTION ( C1,
    C2 )
    Value:
    class C1 : public C2 \
    { \
    public: \
    C1(const char* theMessage = "") \
    : C2(theMessage) \
    { \
    } \
    \
    C1(const char* theMessage, const char* theStackTrace) \
    : C2(theMessage, theStackTrace) \
    { \
    } \
    \
    const char* ExceptionType() const noexcept override \
    { \
    return #C1; \
    } \
    };

    Defines an exception class inheriting from Standard_Failure.

    This macro creates a complete exception class with:

    • Constructors that forward to base class
    • ExceptionType() override returning the class name

    Usage:

    DEFINE_STANDARD_EXCEPTION(Standard_OutOfRange, Standard_RangeError)
    #define DEFINE_STANDARD_EXCEPTION(C1, C2)
    Defines an exception class inheriting from Standard_Failure.
    Definition Standard_DefineException.hxx:34
    Parameters
    C1Name of the exception class to define
    C2Name of the parent exception class (must be Standard_Failure or derived)