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)
51#define OPM_THROW(Exception, message) \
53 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
54 std::to_string(__LINE__) + "] " + \
56 ::Opm::OpmLog::error(oss_); \
57 throw Exception(oss_); \
63#define OPM_THROW_NOLOG(Exception, message) \
65 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
66 std::to_string(__LINE__) + "] " + \
68 throw Exception(oss_); \
72#define OPM_ERROR_IF(condition, message) do {if(condition){ OPM_THROW(std::logic_error, message);}} while(false)