v0.14.0
Public Member Functions | List of all members
MoFEM::Exceptions::ErrorChecker< LINE > Struct Template Reference

Error check for inline function check. More...

#include <include/Exceptions.hpp>

Public Member Functions

void operator<< (const MoFEMErrorCode err)
 Operator for handling PetscErrorCode and MoFEMErrorCode. More...
 
void operator<< (const moab::ErrorCode err)
 Operator for handling moab::ErrorCode. More...
 

Detailed Description

template<int LINE>
struct MoFEM::Exceptions::ErrorChecker< LINE >

Error check for inline function check.

This class is not used directly, it is called in CHKERR. In case of the error pass line number and that is catch at the end of the function. Information is enriched by function name and file name. Then error is pushed to PETSc error stack.

Note
This class has no variables and line number is set at compilation. Adding variables to this function will reduce efficiency of the code. Do not do that.

Definition at line 92 of file Exceptions.hpp.

Member Function Documentation

◆ operator<<() [1/2]

template<int LINE>
void MoFEM::Exceptions::ErrorChecker< LINE >::operator<< ( const moab::ErrorCode  err)
inline

Operator for handling moab::ErrorCode.

Definition at line 109 of file Exceptions.hpp.

109  {
110  if (PetscLikely(MB_SUCCESS != err)) {
111  std::string error_str = (unsigned)err <= (unsigned)MB_FAILURE
112  ? moab::ErrorCodeStr[err]
113  : "INVALID ERROR CODE";
114  std::string str("MOAB error (" + boost::lexical_cast<std::string>(err) +
115  ") " + error_str);
116  throw MoFEMExceptionInitial(MOFEM_MOAB_ERROR, str.c_str(), LINE);
117  }
118  return;
119  }

◆ operator<<() [2/2]

template<int LINE>
void MoFEM::Exceptions::ErrorChecker< LINE >::operator<< ( const MoFEMErrorCode  err)
inline

Operator for handling PetscErrorCode and MoFEMErrorCode.

Definition at line 98 of file Exceptions.hpp.

98  {
99  if (PetscUnlikely(err)) {
100  throw MoFEMExceptionRepeat(err, LINE);
101  }
102  return;
103  }

The documentation for this struct was generated from the following file:
MOFEM_MOAB_ERROR
@ MOFEM_MOAB_ERROR
Definition: definitions.h:41