Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
ErrorHandler.hpp File Reference
#include "moab/Types.hpp"
#include <sstream>
#include <cstring>
+ Include dependency graph for ErrorHandler.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 moab
 Class representing axis-aligned bounding box.
 

Macros

#define __FILENAME__   ( strrchr( __FILE__, '/' ) ? strrchr( __FILE__, '/' ) + 1 : __FILE__ )
 
#define MBSTRINGIFY_(X)   #X
 
#define MBSTRINGIFY(X)   MBSTRINGIFY_( X )
 
#define __MBSDIR__   ""
 
#define MB_SET_ERR(err_code, err_msg)
 Set a new error with the given error message (a string or a stream) and return the given error code Used in functions which return ErrorCode. More...
 
#define MB_SET_ERR_RET(err_msg)
 Set a new error with the given error message (a string or a stream) and return Used in functions which return void types (or have no return types at all, e.g. constructors) More...
 
#define MB_SET_ERR_RET_VAL(err_msg, ret_val)
 Set a new error with the given error message (a string or a stream) and return the given value Used in functions which return any data type. More...
 
#define MB_SET_ERR_CONT(err_msg)
 Set a new error with the given error message (a string or a stream) and continue Used in functions which return any data type. More...
 
#define MB_SET_GLB_ERR(err_code, err_msg)
 Similar to MB_SET_ERR except that the error is considered globally fatal. More...
 
#define MB_SET_GLB_ERR_RET(err_msg)
 Similar to MB_SET_ERR_RET except that the error is considered globally fatal. More...
 
#define MB_SET_GLB_ERR_RET_VAL(err_msg, ret_val)
 Similar to MB_SET_ERR_RET_VAL except that the error is considered globally fatal. More...
 
#define MB_SET_GLB_ERR_CONT(err_msg)
 Similar to MB_SET_ERR_CONT except that the error is considered globally fatal. More...
 
#define MB_CHK_ERR(err_code)
 Check error code, if not MB_SUCCESS, call the error handler and return the given error code Used in functions which return ErrorCode. More...
 
#define MB_CHK_ERR_RET(err_code)
 Check error code, if not MB_SUCCESS, call the error handler and return Used in functions which return void types (or have no return types at all, e.g. constructors) More...
 
#define MB_CHK_ERR_RET_VAL(err_code, ret_val)
 Check error code, if not MB_SUCCESS, call the error handler and return the given value Used in functions which return any data type. More...
 
#define MB_CHK_ERR_CONT(err_code)
 Check error code, if not MB_SUCCESS, call the error handler and continue Used in functions which return any data type. More...
 
#define MB_CHK_SET_ERR(err_code, err_msg)
 Check error code, if not MB_SUCCESS, set a new error with the given error message and return the given error code Used in functions which return ErrorCode. More...
 
#define MB_CHK_SET_ERR_RET(err_code, err_msg)
 Check error code, if not MB_SUCCESS, set a new error with the given error message and return Used in functions which return void types (or have no return types at all, e.g. constructors) More...
 
#define MB_CHK_SET_ERR_RET_VAL(err_code, err_msg, ret_val)
 Check error code, if not MB_SUCCESS, set a new error with the given error message and return the given value Used in functions which return any data type. More...
 
#define MB_CHK_SET_ERR_CONT(err_code, err_msg)
 Check error code, if not MB_SUCCESS, set a new error with the given error message and continue Used in functions which return any data type. More...
 

Enumerations

enum  moab::ErrorType { moab::MB_ERROR_TYPE_NEW_GLOBAL = 0 , moab::MB_ERROR_TYPE_NEW_LOCAL = 1 , moab::MB_ERROR_TYPE_EXISTING = 2 }
 ErrorType - passed to the error handling routines indicating whether this is a new error (globally fatal or per-processor relevant) to be created, or an existing one to be handled. More...
 

Functions

void moab::MBErrorHandler_Init ()
 Initialize MOAB error handler (e.g. create a utility object for printing error output) More...
 
void moab::MBErrorHandler_Finalize ()
 Finalize MOAB error handler (e.g. delete the utility object for printing error output) More...
 
bool moab::MBErrorHandler_Initialized ()
 Indicates whether MBErrorHandler_Init has been called. More...
 
void moab::MBErrorHandler_GetLastError (std::string &error)
 Get information about the last error. More...
 
ErrorCode moab::MBError (int line, const char *func, const char *file, const char *dir, ErrorCode err_code, const char *err_msg, ErrorType err_type)
 Routine that is called to create a new error or handle an existing one. More...
 

Macro Definition Documentation

◆ __FILENAME__

#define __FILENAME__   ( strrchr( __FILE__, '/' ) ? strrchr( __FILE__, '/' ) + 1 : __FILE__ )

Definition at line 48 of file ErrorHandler.hpp.

◆ __MBSDIR__

#define __MBSDIR__   ""

Definition at line 56 of file ErrorHandler.hpp.

◆ MB_CHK_ERR

#define MB_CHK_ERR (   err_code)
Value:
do \
{ \
if( moab::MB_SUCCESS != ( err_code ) ) \
return moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, err_code, "", \
} while( false )

Check error code, if not MB_SUCCESS, call the error handler and return the given error code Used in functions which return ErrorCode.

Examples
DeformMeshRemap.cpp, ErrorHandlingSimulation.cpp, ExtrudePoly.cpp, GenLargeMesh.cpp, GetEntities.cpp, HelloMOAB.cpp, HelloParMOAB.cpp, LaplacianSmoother.cpp, LloydRelaxation.cpp, LoadPartial.cpp, ReadPartFile.cpp, ReadWriteTest.cpp, ReduceExchangeTags.cpp, SetsNTags.cpp, StructuredMeshSimple.cpp, TestErrorHandling.cpp, TestErrorHandlingPar.cpp, TestExodusII.cpp, and copyPartition.cpp.

Definition at line 149 of file ErrorHandler.hpp.

◆ MB_CHK_ERR_CONT

#define MB_CHK_ERR_CONT (   err_code)
Value:
do \
{ \
if( moab::MB_SUCCESS != ( err_code ) ) \
{ \
moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, err_code, "", moab::MB_ERROR_TYPE_EXISTING ); \
} \
} while( false )

Check error code, if not MB_SUCCESS, call the error handler and continue Used in functions which return any data type.

Definition at line 183 of file ErrorHandler.hpp.

◆ MB_CHK_ERR_RET

#define MB_CHK_ERR_RET (   err_code)
Value:
do \
{ \
if( moab::MB_SUCCESS != ( err_code ) ) \
{ \
moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, err_code, "", moab::MB_ERROR_TYPE_EXISTING ); \
return; \
} \
} while( false )

Check error code, if not MB_SUCCESS, call the error handler and return Used in functions which return void types (or have no return types at all, e.g. constructors)

Definition at line 159 of file ErrorHandler.hpp.

◆ MB_CHK_ERR_RET_VAL

#define MB_CHK_ERR_RET_VAL (   err_code,
  ret_val 
)
Value:
do \
{ \
if( moab::MB_SUCCESS != ( err_code ) ) \
{ \
moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, err_code, "", moab::MB_ERROR_TYPE_EXISTING ); \
return ret_val; \
} \
} while( false )

Check error code, if not MB_SUCCESS, call the error handler and return the given value Used in functions which return any data type.

Definition at line 171 of file ErrorHandler.hpp.

◆ MB_CHK_SET_ERR

#define MB_CHK_SET_ERR (   err_code,
  err_msg 
)
Value:
do \
{ \
if( moab::MB_SUCCESS != ( err_code ) ) MB_SET_ERR( err_code, err_msg ); \
} while( false )

Check error code, if not MB_SUCCESS, set a new error with the given error message and return the given error code Used in functions which return ErrorCode.

Examples
ComputeTriDual.cpp, CrystalRouterExample.cpp, DeformMeshRemap.cpp, DirectAccessNoHoles.cpp, DirectAccessWithHoles.cpp, ExtractLand.cpp, ExtrudePoly.cpp, GenLargeMesh.cpp, LoadPartial.cpp, QuadTriConv.cpp, ReduceExchangeTags.cpp, TestErrorHandling.cpp, VisTags.cpp, addPCdata.cpp, and copyPartition.cpp.

Definition at line 194 of file ErrorHandler.hpp.

◆ MB_CHK_SET_ERR_CONT

#define MB_CHK_SET_ERR_CONT (   err_code,
  err_msg 
)
Value:
do \
{ \
if( moab::MB_SUCCESS != ( err_code ) ) MB_SET_ERR_CONT( err_msg ); \
} while( false )

Check error code, if not MB_SUCCESS, set a new error with the given error message and continue Used in functions which return any data type.

Definition at line 218 of file ErrorHandler.hpp.

◆ MB_CHK_SET_ERR_RET

#define MB_CHK_SET_ERR_RET (   err_code,
  err_msg 
)
Value:
do \
{ \
if( moab::MB_SUCCESS != ( err_code ) ) MB_SET_ERR_RET( err_msg ); \
} while( false )

Check error code, if not MB_SUCCESS, set a new error with the given error message and return Used in functions which return void types (or have no return types at all, e.g. constructors)

Definition at line 202 of file ErrorHandler.hpp.

◆ MB_CHK_SET_ERR_RET_VAL

#define MB_CHK_SET_ERR_RET_VAL (   err_code,
  err_msg,
  ret_val 
)
Value:
do \
{ \
if( moab::MB_SUCCESS != ( err_code ) ) MB_SET_ERR_RET_VAL( err_msg, ret_val ); \
} while( false )

Check error code, if not MB_SUCCESS, set a new error with the given error message and return the given value Used in functions which return any data type.

Definition at line 210 of file ErrorHandler.hpp.

◆ MB_SET_ERR

#define MB_SET_ERR (   err_code,
  err_msg 
)
Value:
do \
{ \
std::ostringstream err_ostr; \
err_ostr << err_msg; \
return moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, err_code, err_ostr.str().c_str(), \
} while( false )

Set a new error with the given error message (a string or a stream) and return the given error code Used in functions which return ErrorCode.

Examples
DeformMeshRemap.cpp, ErrorHandlingSimulation.cpp, and GenLargeMesh.cpp.

Definition at line 61 of file ErrorHandler.hpp.

◆ MB_SET_ERR_CONT

#define MB_SET_ERR_CONT (   err_msg)
Value:
do \
{ \
std::ostringstream err_ostr; \
err_ostr << err_msg; \
moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, moab::MB_FAILURE, err_ostr.str().c_str(), \
} while( false )

Set a new error with the given error message (a string or a stream) and continue Used in functions which return any data type.

Definition at line 96 of file ErrorHandler.hpp.

◆ MB_SET_ERR_RET

#define MB_SET_ERR_RET (   err_msg)
Value:
do \
{ \
std::ostringstream err_ostr; \
err_ostr << err_msg; \
moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, moab::MB_FAILURE, err_ostr.str().c_str(), \
return; \
} while( false )

Set a new error with the given error message (a string or a stream) and return Used in functions which return void types (or have no return types at all, e.g. constructors)

Definition at line 72 of file ErrorHandler.hpp.

◆ MB_SET_ERR_RET_VAL

#define MB_SET_ERR_RET_VAL (   err_msg,
  ret_val 
)
Value:
do \
{ \
std::ostringstream err_ostr; \
err_ostr << err_msg; \
moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, moab::MB_FAILURE, err_ostr.str().c_str(), \
return ret_val; \
} while( false )

Set a new error with the given error message (a string or a stream) and return the given value Used in functions which return any data type.

Definition at line 84 of file ErrorHandler.hpp.

◆ MB_SET_GLB_ERR

#define MB_SET_GLB_ERR (   err_code,
  err_msg 
)
Value:
do \
{ \
std::ostringstream err_ostr; \
err_ostr << err_msg; \
return moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, err_code, err_ostr.str().c_str(), \
} while( false )

Similar to MB_SET_ERR except that the error is considered globally fatal.

Examples
ErrorHandlingSimulation.cpp.

Definition at line 106 of file ErrorHandler.hpp.

◆ MB_SET_GLB_ERR_CONT

#define MB_SET_GLB_ERR_CONT (   err_msg)
Value:
do \
{ \
std::ostringstream err_ostr; \
err_ostr << ( err_msg ); \
moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, moab::MB_FAILURE, err_ostr.str().c_str(), \
} while( false )

Similar to MB_SET_ERR_CONT except that the error is considered globally fatal.

Definition at line 138 of file ErrorHandler.hpp.

◆ MB_SET_GLB_ERR_RET

#define MB_SET_GLB_ERR_RET (   err_msg)
Value:
do \
{ \
std::ostringstream err_ostr; \
err_ostr << ( err_msg ); \
moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, moab::MB_FAILURE, err_ostr.str().c_str(), \
return; \
} while( false )

Similar to MB_SET_ERR_RET except that the error is considered globally fatal.

Definition at line 116 of file ErrorHandler.hpp.

◆ MB_SET_GLB_ERR_RET_VAL

#define MB_SET_GLB_ERR_RET_VAL (   err_msg,
  ret_val 
)
Value:
do \
{ \
std::ostringstream err_ostr; \
err_ostr << ( err_msg ); \
moab::MBError( __LINE__, __func__, __FILENAME__, __MBSDIR__, moab::MB_FAILURE, err_ostr.str().c_str(), \
return ret_val; \
} while( false )

Similar to MB_SET_ERR_RET_VAL except that the error is considered globally fatal.

Definition at line 127 of file ErrorHandler.hpp.

◆ MBSTRINGIFY

#define MBSTRINGIFY (   X)    MBSTRINGIFY_( X )

Definition at line 51 of file ErrorHandler.hpp.

◆ MBSTRINGIFY_

#define MBSTRINGIFY_ (   X)    #X

Definition at line 50 of file ErrorHandler.hpp.