24 #ifndef LSST_PEX_EXCEPTIONS_EXCEPTION_H 25 #define LSST_PEX_EXCEPTIONS_EXCEPTION_H 32 #include "boost/current_function.hpp" 36 namespace exceptions {
40 #define LSST_EXCEPT_HERE __FILE__, __LINE__, BOOST_CURRENT_FUNCTION 46 #define LSST_EXCEPT(type, ...) type(LSST_EXCEPT_HERE, __VA_ARGS__) 51 #define LSST_EXCEPT_ADD(e, m) e.addMessage(LSST_EXCEPT_HERE, m) 55 #define LSST_EARGS_TYPED \ 56 char const* ex_file, int ex_line, char const* ex_func, \ 57 std::string const& ex_message 61 #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 throw() { return #c " *"; }; \ 74 virtual lsst::pex::exceptions::Exception* clone(void) const { \ 75 return new t(*this); \ 89 Tracepoint(
char const* file,
int line,
char const* func,
90 std::string
const & message);
109 Exception(
char const* file,
int line,
char const* func,
110 std::string
const& message);
121 explicit Exception(std::string
const & message);
132 void addMessage(
char const* file,
int line,
char const* func,
133 std::string
const& message);
136 Traceback
const& getTraceback(
void)
const throw();
144 virtual std::ostream& addToStream(std::ostream& stream)
const;
156 virtual char const* what(
void)
const throw();
164 virtual char const* getType(
void)
const throw();
175 Traceback _traceback;
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