42 #ifndef TEUCHOS_STANDARD_CATCH_MACROS_HPP
43 #define TEUCHOS_STANDARD_CATCH_MACROS_HPP
52 #ifdef HAVE_TEUCHOS_STACKTRACE
53 # define TEUCHOS_GET_STORED_STACKTRACE() \
54 (Teuchos::TestForException_getEnableStacktrace() \
55 ? Teuchos::get_stored_stacktrace() + "\n" \
58 # define TEUCHOS_GET_STORED_STACKTRACE() ""
65 #define TEUCHOS_STANDARD_CATCH_STATEMENTS_IMPL(VERBOSE, ERR_STREAM, \
66 SHOW_STACK_TRACE, SUCCESS_FLAG \
68 catch (const std::exception &excpt) { \
70 std::ostringstream oss; \
72 << "\np="<<::Teuchos::GlobalMPISession::getRank() \
73 <<": *** Caught standard std::exception of type \'" \
74 <<Teuchos::concreteTypeName(excpt)<<"\' :\n\n"; \
75 Teuchos::OSTab scsi_tab(oss); \
76 if (SHOW_STACK_TRACE) { \
77 scsi_tab.o() << TEUCHOS_GET_STORED_STACKTRACE(); \
79 scsi_tab.o() << excpt.what() << std::endl; \
80 (ERR_STREAM) << std::flush; \
81 (ERR_STREAM) << oss.str(); \
82 (SUCCESS_FLAG) = false; \
85 catch (const int &excpt_code) { \
87 std::ostringstream oss; \
89 << "\np="<<::Teuchos::GlobalMPISession::getRank() \
90 << ": *** Caught an integer exception with value = " \
91 << excpt_code << std::endl; \
92 (ERR_STREAM) << std::flush; \
93 (ERR_STREAM) << oss.str(); \
94 (SUCCESS_FLAG) = false; \
99 std::ostringstream oss; \
100 oss << "\np="<<::Teuchos::GlobalMPISession::getRank() \
101 <<": *** Caught an unknown exception\n"; \
102 (ERR_STREAM) << std::flush; \
103 (ERR_STREAM) << oss.str(); \
104 (SUCCESS_FLAG) = false; \
136 #define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG) \
137 TEUCHOS_STANDARD_CATCH_STATEMENTS_IMPL(VERBOSE, ERR_STREAM, true, SUCCESS_FLAG)
140 #endif // TEUCHOS_STANDARD_CATCH_MACROS_HPP
Functions for returning stacktrace info (GCC only initially).
A MPI utilities class, providing methods for initializing, finalizing, and querying the global MPI se...
Defines basic traits returning the name of a type in a portable and readable way. ...