19#ifndef LOMIRI_EXCEPTION_H
20#define LOMIRI_EXCEPTION_H
22#include <lomiri/SymbolExport.h>
31class ExceptionImplBase;
103class LOMIRI_API
Exception :
public std::exception,
public std::nested_exception
112 char const*
what()
const noexcept override;
120 virtual std::exception_ptr
self()
const = 0;
122 std::string
name()
const;
123 std::string
reason()
const;
125 std::string
to_string(std::string
const& indent =
" ")
const;
126 std::string
to_string(
int indent_level, std::string
const& indent)
const;
128 std::exception_ptr
remember(std::exception_ptr earlier_exception);
137 mutable std::
string what_;
138 std::exception_ptr earlier_;
char const * what() const noexcept override
Returns a string describing the exception, including any exceptions that were nested or chained.
Definition Exception.cpp:189
std::exception_ptr remember(std::exception_ptr earlier_exception)
Adds an exception to the exception history chain.
Definition Exception.cpp:307
Exception(std::string const &name, std::string const &reason)
Constructs an exception instance.
Definition Exception.cpp:165
std::string to_string(std::string const &indent=" ") const
Returns a string describing the exception, including any exceptions that were nested or chained.
Definition Exception.cpp:241
std::string reason() const
Returns the reason set by the derived class's constructor (empty string if none).
Definition Exception.cpp:224
std::string name() const
Returns the name set by the derived class's constructor.
Definition Exception.cpp:212
std::exception_ptr get_earlier() const noexcept
Returns the previous exception.
Definition Exception.cpp:323
virtual std::exception_ptr self() const =0
Returns a std::exception_ptr to this.
Top-level namespace for all things Lomiri-related.
Definition Version.h:38