10 #ifndef TEUCHOS_STANDARD_CATCH_MACROS_HPP
11 #define TEUCHOS_STANDARD_CATCH_MACROS_HPP
20 #ifdef HAVE_TEUCHOS_STACKTRACE
21 # define TEUCHOS_GET_STORED_STACKTRACE() \
22 (Teuchos::TestForException_getEnableStacktrace() \
23 ? Teuchos::get_stored_stacktrace() + "\n" \
26 # define TEUCHOS_GET_STORED_STACKTRACE() ""
33 #define TEUCHOS_STANDARD_CATCH_STATEMENTS_IMPL(VERBOSE, ERR_STREAM, \
34 SHOW_STACK_TRACE, SUCCESS_FLAG \
36 catch (const std::exception &excpt) { \
38 std::ostringstream oss; \
40 << "\np="<<::Teuchos::GlobalMPISession::getRank() \
41 <<": *** Caught standard std::exception of type \'" \
42 <<Teuchos::concreteTypeName(excpt)<<"\' :\n\n"; \
43 Teuchos::OSTab scsi_tab(oss); \
44 if (SHOW_STACK_TRACE) { \
45 scsi_tab.o() << TEUCHOS_GET_STORED_STACKTRACE(); \
47 scsi_tab.o() << excpt.what() << std::endl; \
48 (ERR_STREAM) << std::flush; \
49 (ERR_STREAM) << oss.str(); \
50 (SUCCESS_FLAG) = false; \
53 catch (const int &excpt_code) { \
55 std::ostringstream oss; \
57 << "\np="<<::Teuchos::GlobalMPISession::getRank() \
58 << ": *** Caught an integer exception with value = " \
59 << excpt_code << std::endl; \
60 (ERR_STREAM) << std::flush; \
61 (ERR_STREAM) << oss.str(); \
62 (SUCCESS_FLAG) = false; \
67 std::ostringstream oss; \
68 oss << "\np="<<::Teuchos::GlobalMPISession::getRank() \
69 <<": *** Caught an unknown exception\n"; \
70 (ERR_STREAM) << std::flush; \
71 (ERR_STREAM) << oss.str(); \
72 (SUCCESS_FLAG) = false; \
104 #define TEUCHOS_STANDARD_CATCH_STATEMENTS(VERBOSE, ERR_STREAM, SUCCESS_FLAG) \
105 TEUCHOS_STANDARD_CATCH_STATEMENTS_IMPL(VERBOSE, ERR_STREAM, true, SUCCESS_FLAG)
108 #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. ...