@@ -33,28 +33,30 @@ void throw_exception(const std::string& msg)
33
33
if constexpr (std::is_constructible<exception_type, const std::string&>::value) {
34
34
throw exception_type (msg);
35
35
} else if constexpr (std::is_default_constructible<exception_type>::value) {
36
- std::cerr << msg;
36
+ std::cerr << msg << " \n " ;
37
37
throw exception_type ();
38
38
} else {
39
39
std::cerr << msg << " \n " ;
40
40
std::cerr << " Cannot create exception of type\n " ;
41
41
std::cerr << " " << typeid (exception_type).name () << " \n " ;
42
- std::cerr << " The program will terminate\n " ;
42
+ std::cerr << " Throwing std::runtime_error instead...\n " ;
43
+ throw std::runtime_error (msg);
43
44
}
44
45
}
45
46
46
47
} // namespace ekat
47
48
48
49
// Internal do not call directly.
49
50
#define IMPL_THROW (condition, msg, exception_type ) \
50
- do { \
51
- if ( ! (condition) ) { \
52
- std::stringstream _ss_; \
53
- _ss_ << " \n FAIL:\n " << #condition << " \n " ; \
54
- _ss_ << EKAT_BACKTRACE; \
55
- _ss_ << " \n " << msg; \
56
- ekat::throw_exception<exception_type>(_ss_.str ()); \
57
- } \
51
+ do { \
52
+ if ( ! (condition) ) { \
53
+ std::cerr << " \n FAILED CONDITION: '" << #condition << " '\n\n " ; \
54
+ std::cerr << " BACKTRACE:\n " ; \
55
+ std::cerr << EKAT_BACKTRACE << " \n " ; \
56
+ std::stringstream ss; \
57
+ ss << msg; \
58
+ ekat::throw_exception<exception_type>(ss.str ()); \
59
+ } \
58
60
} while (0 )
59
61
60
62
// Define the EKAT_REQUIRE macros for different argument counts
0 commit comments