16#include "AUI/Reflect/AReflect.h"
17#include <AUI/Common/AVector.h>
18#include <AUI/Platform/AStacktrace.h>
19#include <AUI/Traits/strings.h>
46 : mCausedBy(std::move(causedBy)),
47 mStacktrace(std::move(stacktrace))
52 virtual AString getMessage()
const noexcept {
53 return mMessage ? mMessage->c_str() :
"<no message>";
58 const char* what()
const noexcept override {
59 if (!mMessage) mMessage = getMessage().toStdString();
60 return mMessage->c_str();
68 const std::exception_ptr& causedBy()
const noexcept {
74 std::exception_ptr mCausedBy;
78inline std::ostream& operator<<(std::ostream& o,
const AException& e)
noexcept {
88 std::rethrow_exception(e.causedBy());
91 }
catch (
const std::exception& e) {
94 o <<
"unknown exception";
Abstract AUI exception.
Definition: AException.h:29
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition: AOptional.h:32
Stacktrace consisting of a collection of stack function frames.
Definition: AStacktrace.h:28
static AStacktrace capture(unsigned skipFrames=0, unsigned maxFrames=128) noexcept
Creates stacktrace of the current thread.
Definition: AStacktraceImpl.cpp:156
Represents a Unicode character string.
Definition: AString.h:37
std::string toStdString() const noexcept
Definition: AString.cpp:338