25#define __attribute__(x)
43 : _message(message), _traceback(1,
Tracepoint(file, line, func, message)) {}
52 if (_traceback.empty()) {
63 stream <<
"; " << message;
65 if (_traceback.size() ==
static_cast<std::size_t>(1)) {
73 stream << message <<
" {" << _traceback.
size() <<
"}";
74 _traceback.push_back(
Tracepoint(file, line, func, message));
76 _message = stream.
str();
82 if (_traceback.empty()) {
88 for (
std::size_t i = 0; i != _traceback.size(); ++i) {
89 stream <<
" File \"" << _traceback[i]._file <<
"\", line " << _traceback[i]._line <<
", in "
91 stream <<
" " << _traceback[i]._message <<
" {" << i <<
"}" <<
std::endl;
94 stream << type <<
": '" << _message <<
"'" <<
std::endl;
Provides consistent interface for LSST exceptions.
void addMessage(char const *file, int line, char const *func, std::string const &message)
Add a tracepoint and a message to an exception before rethrowing it (access via LSST_EXCEPT_ADD).
virtual char const * getType(void) const noexcept
Return the fully-specified C++ type of a pointer to the exception.
virtual Exception * clone(void) const
Return a copy of the exception as an Exception pointer.
virtual std::ostream & addToStream(std::ostream &stream) const
Add a text representation of this exception, including its traceback with messages,...
virtual ~Exception(void) noexcept
Traceback const & getTraceback(void) const noexcept
Retrieve the list of tracepoints associated with an exception.
Exception(char const *file, int line, char const *func, std::string const &message)
Standard constructor, intended for C++ use via the LSST_EXCEPT() macro.
virtual char const * what(void) const noexcept
Return a character string summarizing this exception.
std::ostream & operator<<(std::ostream &stream, Exception const &e)
Push the text representation of an exception onto a stream.
std::vector< Tracepoint > Traceback
One point in the Traceback vector held by Exception.
Tracepoint(char const *file, int line, char const *func, std::string const &message)
Standard constructor, intended for C++ use.