|
TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
|
#include <triqs/utility/exceptions.hpp>
Base class for exceptions thrown in TRIQS.
A triqs::exception carries a std::stringstream accumulator that the user can extend with operator<<(). When what() is called, the accumulated message is returned, followed by the rank of the throwing MPI process and (if the environment variable TRIQS_SHOW_EXCEPTION_TRACE is set) by the C++ stack trace captured at construction.
Definition at line 75 of file exceptions.hpp.
Public Member Functions | |
| exception () noexcept | |
| Default constructor ceates an exception with an empty diagnostic message and an empty stack trace. | |
| exception (exception const &e) noexcept | |
| Copy constructor copies the accumulated diagnostic message, the captured stack trace and the cached what() string from another exception. | |
| virtual | ~exception () noexcept |
| Virtual default destructor. | |
| exception & | operator<< (const char *mess) |
| Append a C string to the accumulated diagnostic message. | |
| template<typename T> | |
| exception & | operator<< (T const &x) |
| Append a value to the accumulated diagnostic message. | |
| virtual const char * | trace () const noexcept |
| Get the captured stack trace. | |
| virtual const char * | what () const noexcept |
| Build and return the full diagnostic message. | |
|
inlinenoexcept |
Copy constructor copies the accumulated diagnostic message, the captured stack trace and the cached what() string from another exception.
| e | Exception to copy from. |
Definition at line 90 of file exceptions.hpp.
|
inline |
Append a C string to the accumulated diagnostic message.
| mess | Null-terminated C string to append to the message. |
Definition at line 115 of file exceptions.hpp.
|
inline |
Append a value to the accumulated diagnostic message.
The value is streamed into the internal std::stringstream accumulator.
| T | Type streamable into a std::ostream. |
| x | Value to append to the message. |
Definition at line 104 of file exceptions.hpp.
|
inlinevirtualnoexcept |
Get the captured stack trace.
Definition at line 142 of file exceptions.hpp.
|
inlinevirtualnoexcept |
Build and return the full diagnostic message.
Concatenates the accumulated message, the rank of the throwing MPI process (when MPI is initialized) and, if the environment variable TRIQS_SHOW_EXCEPTION_TRACE is set, the captured C++ stack trace. The result is cached in a member so the returned pointer stays valid for the lifetime of the exception object.
Definition at line 129 of file exceptions.hpp.