25 # define __attribute__(x) 35 namespace lsst {
namespace pex {
namespace exceptions {
38 char const* file,
int line,
char const* func,
41 _file(file), _line(line), _func(func), _message(message)
45 char const* file,
int line,
char const* func,
51 ) : _message(message), _traceback() {}
56 char const* file,
int line,
char const* func,
std::string const& message
60 if (_traceback.
empty()) {
71 stream <<
"; " << message;
81 stream << message <<
" {" << _traceback.
size() <<
"}";
84 _message = stream.
str();
94 if (_traceback.
empty()) {
101 stream <<
" File \"" << _traceback[i]._file
102 <<
"\", line " << _traceback[i]._line
103 <<
", in " << _traceback[i]._func <<
std::endl;
104 stream <<
" " << _traceback[i]._message <<
" {" << i <<
"}" <<
std::endl;
107 stream << type <<
": '" << _message <<
"'" <<
std::endl;
113 return _message.
c_str();
117 return "lsst::pex::exceptions::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.
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 std::ostream & addToStream(std::ostream &stream) const
Add a text representation of this exception, including its traceback with messages, to a stream.
virtual Exception * clone(void) const
Return a copy of the exception as an Exception*.
Tracepoint(char const *file, int line, char const *func, std::string const &message)
Standard constructor, intended for C++ use.
Traceback const & getTraceback(void) const
Retrieve the list of tracepoints associated with an exception.
virtual char const * what(void) const
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.
virtual char const * getType(void) const
Return the fully-specified C++ type of a pointer to the exception.
One point in the Traceback vector held by Exception.