LevelS C++ support library  3.83
Macros
Error handling

Macros

#define planck_fail(msg)
 
#define planck_fail_quietly(msg)   do { throw PlanckError(msg); } while(0)
 
#define planck_assert(testval, msg)   do { if (testval); else planck_fail(msg); } while(0)
 
#define PLANCK_DIAGNOSIS_BEGIN   try {
 
#define PLANCK_DIAGNOSIS_END
 

Detailed Description

Macro Definition Documentation

◆ planck_fail

#define planck_fail (   msg)
Value:
do { planck_failure__(__FILE__,__LINE__,PLANCK_FUNC_NAME__,msg); \
throw PlanckError(msg); } while(0)

Writes diagnostic output and exits with an error status.

Definition at line 69 of file error_handling.h.

◆ planck_fail_quietly

#define planck_fail_quietly (   msg)    do { throw PlanckError(msg); } while(0)

Throws a PlanckError without diagnostic message.

Definition at line 74 of file error_handling.h.

◆ planck_assert

#define planck_assert (   testval,
  msg 
)    do { if (testval); else planck_fail(msg); } while(0)

Writes diagnostic output and exits with an error status if testval is false.

Definition at line 79 of file error_handling.h.

◆ PLANCK_DIAGNOSIS_BEGIN

#define PLANCK_DIAGNOSIS_BEGIN   try {

Macro for improving error diagnostics. Should be placed immediately after the opening brace of main(). Must be used in conjunction with PLANCK_DIAGNOSIS_END.

Definition at line 85 of file error_handling.h.

◆ PLANCK_DIAGNOSIS_END

#define PLANCK_DIAGNOSIS_END
Value:
} \
catch (PlanckError &) \
{ killjob__(); /* no need for further diagnostics; they were shown already */ } \
catch (std::exception &e) \
{ std::cerr << "std::exception: " << e.what() << std::endl; killjob__(); } \
catch (...) \
{ std::cerr << "Unknown exception" << std::endl; killjob__(); }

Macro for improving error diagnostics. Should be placed immediately before the closing brace of main(). Must be used in conjunction with PLANCK_DIAGNOSIS_BEGIN.

Definition at line 89 of file error_handling.h.


Generated on Wed Nov 13 2024 12:18:16 for LevelS C++ support library