84 :
public std::logic_error
93 virtual char const *
what()
const throw() override;
98 : public std::out_of_range
107 virtual char const *
what()
const throw() override;
112 : public std::runtime_error
121 virtual char const *
what()
const throw() override;
125#define DECLARE_LOGIC_ERROR(name) \
126 class name : public ::libexcept::logic_exception_t { \
127 public: name(std::string const & msg) : logic_exception_t(#name ": " + msg) {} }
129#define DECLARE_OUT_OF_RANGE(name) \
130 class name : public ::libexcept::out_of_range_t { \
131 public: name(std::string const & msg) : out_of_range_t(#name ": " + msg) {} }
133#define DECLARE_MAIN_EXCEPTION(name) \
134 class name : public ::libexcept::exception_t { \
135 public: name(std::string const & msg) : exception_t(#name ": " + msg) {} }
137#define DECLARE_EXCEPTION(base, name) \
138 class name : public base { \
139 public: name(std::string const & msg) : base(msg) {} }
exception_base_t & set_parameter(std::string const &name, std::string const &value)
Set a parameter in this exception.
parameter_t const & get_parameters() const
Retrieve the set of exception parameters.
std::string get_parameter(std::string const &name) const
Retrieve one of the exception parameters.
stack_trace_t f_stack_trace
The variable where the exception stack trace gets saved.
stack_trace_t const & get_stack_trace() const
Retrieve the stack trace.
virtual ~exception_base_t()
Destructor of the exception base class.
virtual ~exception_t() override
Destructor of the exception class.
virtual ~logic_exception_t() override
Destructor of the logic exception class.
virtual char const * what() const override
Retrieve the what parameter as passed to the constructor.
virtual ~out_of_range_t() override
Destructor of the out_of_range exception class.
#define DECLARE_LOGIC_ERROR(name)
void set_collect_stack(collect_stack_t collect_stack)
Set a general flag on whether to collect stack traces or not.
constexpr int const STACK_TRACE_DEPTH
Default depth of stack traces collected.
std::map< std::string, std::string > parameter_t
collect_stack_t get_collect_stack()
Tells you whether the general flag is true or false.
std::list< std::string > stack_trace_t
The stack trace results.
Declarations of the stack trace functions.