Loading...
Searching...
No Matches
21#ifndef OPM_ERRORMACROS_HPP
22#define OPM_ERRORMACROS_HPP
24#include <opm/common/OpmLog/OpmLog.hpp>
34# define OPM_REPORT do { std::cerr << "[" << __FILE__ << ":" << __LINE__ << "] " } while (false)
35# define OPM_MESSAGE(x) do { OPM_REPORT; std::cerr << x << "\n"; } while (false)
36# define OPM_MESSAGE_IF(cond, m) do {if(cond) OPM_MESSAGE(m);} while (false)
38# define OPM_REPORT do {} while (false)
39# define OPM_MESSAGE(x) do {} while (false)
40# define OPM_MESSAGE_IF(cond, m) do {} while (false)
52#define OPM_THROW(Exception, message) \
54 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
55 std::to_string(__LINE__) + "] " + \
57 ::Opm::OpmLog::error(oss_); \
58 throw Exception(oss_); \
70#define OPM_THROW_PROBLEM(Exception, message) \
72 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
73 std::to_string(__LINE__) + "] " + \
75 ::Opm::OpmLog::problem(oss_); \
76 throw Exception(oss_); \
82#define OPM_THROW_NOLOG(Exception, message) \
84 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
85 std::to_string(__LINE__) + "] " + \
87 throw Exception(oss_); \
91#define OPM_ERROR_IF(condition, message) do {if(condition){ OPM_THROW(std::logic_error, message);}} while(false)