v0.8.23
Public Member Functions | List of all members
MoFEM::Exceptions::ErrorCheckerCode< 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::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 102 of file Exceptions.hpp.

Member Function Documentation

◆ operator<<() [1/2]

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

Operator for handling PetscErrorCode and MoFEMErrorCode.

Definition at line 108 of file Exceptions.hpp.

108  {
109  if (PetscUnlikely(err)) {
110  throw MoFEMExceptionRepeat(err, LINE);
111  }
112  return;
113  }

◆ operator<<() [2/2]

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

Operator for handling moab::ErrorCode.

Definition at line 119 of file Exceptions.hpp.

119  {
120  if (PetscLikely(MB_SUCCESS != err)) {
121  std::string error_str = (unsigned)err <= (unsigned)MB_FAILURE
122  ? moab::ErrorCodeStr[err]
123  : "INVALID ERROR CODE";
124  std::string str("MOAB error (" + boost::lexical_cast<std::string>(err) +
125  ") " + error_str);
126  throw MoFEMExceptionInitial(MOFEM_MOAB_ERROR, str.c_str(), LINE);
127  }
128  return;
129  }

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