ErrorMacros.hpp File Reference
#include <iostream>
#include <string>
Include dependency graph for ErrorMacros.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define OPM_THROW(Exception, message)
 
#define OPM_THROW_NOLOG   OPM_THROW
 
#define OPM_ERROR_IF(condition, message)   do {if(condition){ OPM_THROW(std::logic_error, message);}} while(false)
 
#define OPM_MESSAGE(x)   do { std::cerr << x << std::endl; } while(false)
 

Macro Definition Documentation

◆ OPM_ERROR_IF

#define OPM_ERROR_IF (   condition,
  message 
)    do {if(condition){ OPM_THROW(std::logic_error, message);}} while(false)

◆ OPM_MESSAGE

#define OPM_MESSAGE (   x)    do { std::cerr << x << std::endl; } while(false)

◆ OPM_THROW

#define OPM_THROW (   Exception,
  message 
)
Value:
do { \
std::string oss_ = std::string{"["} + __FILE__ + ":" + \
std::to_string(__LINE__) + "] " + \
message; \
throw Exception(oss_); \
} while (false)

◆ OPM_THROW_NOLOG

#define OPM_THROW_NOLOG   OPM_THROW