24 #ifndef LSST_PEX_EXCEPTIONS_EXCEPTION_H 25 #define LSST_PEX_EXCEPTIONS_EXCEPTION_H 32 #include "boost/current_function.hpp" 36 namespace exceptions {
39 #define LSST_EXCEPT_HERE __FILE__, __LINE__, BOOST_CURRENT_FUNCTION 47 #define LSST_EXCEPT(type, ...) type(LSST_EXCEPT_HERE, __VA_ARGS__) 53 #define LSST_EXCEPT_ADD(e, m) e.addMessage(LSST_EXCEPT_HERE, m) 56 #define LSST_EARGS_TYPED char const *ex_file, int ex_line, char const *ex_func, std::string const &ex_message 59 #define LSST_EARGS_UNTYPED ex_file, ex_line, ex_func, ex_message 68 #define LSST_EXCEPTION_TYPE(t, b, c) \ 69 class t : public b { \ 71 t(LSST_EARGS_TYPED) : b(LSST_EARGS_UNTYPED){}; \ 72 t(std::string const& message) : b(message){}; \ 73 virtual char const* getType(void) const noexcept { return #c " *"; }; \ 74 virtual lsst::pex::exceptions::Exception* clone(void) const { return new t(*this); }; \ 141 void addMessage(
char const* file,
int line,
char const* func,
std::string const& message);
144 Traceback
const& getTraceback(
void)
const noexcept;
165 virtual char const* what(
void)
const noexcept;
174 virtual char const* getType(
void)
const noexcept;
186 Traceback _traceback;
Provides consistent interface for LSST exceptions.
Tracepoint(char const *file, int line, char const *func, std::string const &message)
Standard constructor, intended for C++ use.
std::ostream & operator<<(std::ostream &stream, Exception const &e)
Push the text representation of an exception onto a stream.
One point in the Traceback vector held by Exception.
std::vector< Tracepoint > Traceback