v0.8.4
Public Member Functions | List of all members
MoFEM::ErrorCheckerCode< LINE > Struct Template Reference

Error check for inline function check. More...

#include <include/Common.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::ErrorCheckerCode< 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 96 of file Common.hpp.

Member Function Documentation

◆ operator<<() [1/2]

template<int LINE>
void MoFEM::ErrorCheckerCode< LINE >::operator<< ( const MoFEMErrorCode  err)

Operator for handling PetscErrorCode and MoFEMErrorCode.

Definition at line 102 of file Common.hpp.

102  {
103  if (PetscUnlikely(err)) {
104  throw MoFEMExceptionRepeat(err, LINE);
105  }
106  return;
107  }

◆ operator<<() [2/2]

template<int LINE>
void MoFEM::ErrorCheckerCode< LINE >::operator<< ( const moab::ErrorCode  err)

Operator for handling moab::ErrorCode.

Definition at line 113 of file Common.hpp.

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

The documentation for this struct was generated from the following file: