25 # define __attribute__(x)
35 namespace lsst {
namespace pex {
namespace exceptions {
38 char const*
file,
int line,
char const* func,
39 std::string
const& message
41 _file(file), _line(line), _func(func), _message(message)
45 char const*
file,
int line,
char const* func,
46 std::string
const& message
47 ) : _message(message), _traceback(1,
Tracepoint(file, line, func, message)) {}
50 std::string
const& message
51 ) : _message(message), _traceback() {}
56 char const*
file,
int line,
char const* func, std::string
const& message
58 std::ostringstream stream;
71 stream <<
"; " << message;
73 if (
_traceback.size() ==
static_cast<std::size_t
>(1)) {
81 stream << message <<
" {" <<
_traceback.size() <<
"}";
84 _message = stream.str();
100 for (std::size_t i = 0; i !=
_traceback.size(); ++i) {
103 <<
", in " <<
_traceback[i]._func << std::endl;
104 stream <<
" " <<
_traceback[i]._message <<
" {" << i <<
"}" << std::endl;
107 stream << type <<
": '" <<
_message <<
"'" << std::endl;
117 return "lsst::pex::exceptions::Exception *";
125 std::ostream& stream,
Exception const& e) {
virtual char const * getType(void) const
void addMessage(char const *file, int line, char const *func, std::string const &message)
Tracepoint(char const *file, int line, char const *func, std::string const &message)
virtual char const * what(void) const
virtual std::ostream & addToStream(std::ostream &stream) const
std::ostream & operator<<(std::ostream &stream, Exception const &e)
Exception(char const *file, int line, char const *func, std::string const &message)
Traceback const & getTraceback(void) const
Retrieve the list of tracepoints associated with an exception.
One point in the Traceback vector held by Exception.
virtual Exception * clone(void) const
std::vector< Tracepoint > Traceback