6#include "errors/error.hpp"
15 using std::unique_ptr<
error>::unique_ptr;
29 static_assert(std::is_base_of_v<error, E>);
31 auto current = this->get();
32 while (current !=
nullptr) {
33 if (
dynamic_cast<const E *
>(current) !=
nullptr) {
37 current = current->cause().get();
56 static_assert(std::is_base_of_v<error, E>);
58 auto current = this->get();
59 while (current !=
nullptr) {
60 auto result =
dynamic_cast<const E *
>(current);
61 if (result !=
nullptr) {
65 current = current->cause().get();
75 return const_cast<E *
>(std::as_const(*this).as<E>());
78static_assert(!std::is_abstract<error_ptr>());
81#if not defined(ERRORS_DISABLE_OSTREAM)
88 const auto *current = err.get();
97 while (current !=
nullptr) {
103 auto what = current->what();
105 if (what[0] !=
'\0') {
110 current = current->cause().get();
Smart pointer to errors::error with some utility member functions.
Definition error_ptr.hpp:13
E * as()
Looking up error in causes.
Definition error_ptr.hpp:73
const E * as() const
Looking up error in causes.
Definition error_ptr.hpp:54
bool is() const
Check if the error is caused by some kind of errors::error recursively.
Definition error_ptr.hpp:27
Interface representing an error.
Definition error.hpp:20