asynchrony 2.3.1
Add asynchrony to your C++ applications using standard C++20
Loading...
Searching...
No Matches
common.hpp
1#pragma once
2#ifndef ASYNCHRONY_COMMON_HPP
3#define ASYNCHRONY_COMMON_HPP
4
5#include <exception>
6
7
8namespace siddiqsoft
9{
54 static bool isCriticalException(const std::exception_ptr& ep)
55 {
56 if (!ep) return false;
57
58 try {
59 std::rethrow_exception(ep);
60 }
61 catch (const std::bad_alloc&) {
62 // Memory allocation failure - critical
63 return true;
64 }
65 catch (const std::bad_exception&) {
66 // Bad exception - critical
67 return true;
68 }
69 catch (const std::bad_cast&) {
70 // Bad cast - critical
71 return true;
72 }
73 catch (const std::bad_typeid&) {
74 // Bad typeid - critical
75 return true;
76 }
77 catch (const std::exception&) {
78 // Regular exception - not critical
79 return false;
80 }
81 catch (...) {
82 // Unknown exception - treat as critical
83 return true;
84 }
85 }
86} // namespace siddiqsoft
87
88#endif // !ASYNCHRONY_COMMON_HPP