10#if qStroika_Foundation_Execution_Throw_TraceThrowpointBacktrace
14 string ToString_ (
const type_info&);
16 inline string ToString_ (
const T& t)
18 if constexpr (is_convertible_v<T, const exception&>) {
22 return ToString_ (
typeid (T));
26#if qStroika_Foundation_Debug_DefaultTracingOn
27 void JustDbgTrace_ (
const string& msg);
28 void JustDbgTrace_ (
const wstring& msg);
29 void ThrowingExceptionDbgTrace_ (
const string& msg);
30 void ThrowingExceptionDbgTrace_ (
const wstring& msg);
31 void ReThrowingExceptionDbgTrace_ (
const string& msg);
32 void ReThrowingExceptionDbgTrace_ (
const wstring& msg = {});
43 [[noreturn]]
inline void Throw (T&& e2Throw)
45 static_assert (is_convertible_v<remove_cvref_t<T>*, exception*>);
46#if qStroika_Foundation_Debug_DefaultTracingOn
47 Private_::ThrowingExceptionDbgTrace_ (Private_::ToString_ (forward<T> (e2Throw)));
52 [[noreturn]]
inline void Throw (T&& e2Throw, [[maybe_unused]]
const char* traceMsg)
54 static_assert (is_convertible_v<remove_cvref_t<T>*, exception*>);
55#if qStroika_Foundation_Debug_DefaultTracingOn
56 Private_::JustDbgTrace_ (traceMsg);
58 Throw (forward<T> (e2Throw));
61 [[noreturn]]
inline void Throw (T&& e2Throw, [[maybe_unused]]
const wchar_t* traceMsg)
63 static_assert (is_convertible_v<remove_cvref_t<T>*, exception*>);
64#if qStroika_Foundation_Debug_DefaultTracingOn
65 Private_::JustDbgTrace_ (traceMsg);
67 Throw (forward<T> (e2Throw));
77#if qStroika_Foundation_Debug_DefaultTracingOn
78 Private_::ReThrowingExceptionDbgTrace_ ();
82 [[noreturn]]
inline void ReThrow (
const exception_ptr& e)
84#if qStroika_Foundation_Debug_DefaultTracingOn
85 Private_::ReThrowingExceptionDbgTrace_ ();
87 rethrow_exception (e);
89 [[noreturn]]
inline void ReThrow ([[maybe_unused]]
const char* traceMsg)
91#if qStroika_Foundation_Debug_DefaultTracingOn
92 Private_::ReThrowingExceptionDbgTrace_ (traceMsg);
96 [[noreturn]]
inline void ReThrow (
const exception_ptr& e, [[maybe_unused]]
const char* traceMsg)
98#if qStroika_Foundation_Debug_DefaultTracingOn
99 Private_::ReThrowingExceptionDbgTrace_ (traceMsg);
101 rethrow_exception (e);
103 [[noreturn]]
inline void ReThrow ([[maybe_unused]]
const wchar_t* traceMsg)
105#if qStroika_Foundation_Debug_DefaultTracingOn
106 Private_::ReThrowingExceptionDbgTrace_ (traceMsg);
110 [[noreturn]]
inline void ReThrow (
const exception_ptr& e, [[maybe_unused]]
const wchar_t* traceMsg)
112#if qStroika_Foundation_Debug_DefaultTracingOn
113 Private_::ReThrowingExceptionDbgTrace_ (traceMsg);
115 rethrow_exception (e);
123 template <equality_comparable_with<
nullptr_t> T,
typename E>
126 if (p ==
nullptr) [[unlikely]] {
127 Throw (e,
"ThrowIfNull (nullptr) - throwing bad_alloc");
130 template <equality_comparable_with<
nullptr_t> T>
133 static const bad_alloc kException_;
136 template <Common::Weak_Equality_Comparable_With<nullopt_t> T,
typename E>
138 requires (not equality_comparable_with<nullptr_t, T>)
140 if (p == nullopt) [[unlikely]] {
141 Throw (e,
"ThrowIfNull (nullopt) - throwing bad_optional_access");
144 template <Common::Weak_Equality_Comparable_With<nullopt_t> T>
146 requires (not equality_comparable_with<nullptr_t, T>)
148 static const bad_optional_access kException_;
void Throw(T &&e2Throw)
identical to builtin C++ 'throw' except that it does helpful, type dependent DbgTrace() messages firs...
void ThrowIfNull(const Private_::ConstVoidStar &p, const HRESULT &hr)
Template specialization for ThrowIfNull (), for thing being thrown HRESULT - really throw HRESULTErro...