Adds further ext deps as-is binaries copies from customers env.
Qt6 Migration CI / migrate (push) Canceled after 0s
Qt6 Migration CI / migrate (push) Canceled after 0s
This commit is contained in:
3700 files changed
+2132394
No files matched your search
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <exception>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace ddkit {
|
||||
namespace utils {
|
||||
namespace exceptions {
|
||||
|
||||
class GlobalHandler {
|
||||
|
||||
public:
|
||||
template<typename Exception> static void registerHandler(std::function<void(Exception&)> handler){
|
||||
instance().m_registeredHandlers.push_back([handler](std::exception_ptr exceptionPtr){
|
||||
try {
|
||||
std::rethrow_exception(exceptionPtr);
|
||||
} catch (Exception& e) {
|
||||
handler(e);
|
||||
} catch (...){
|
||||
// NO OP
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static void registerHandler(std::function<void(std::exception_ptr)> handler){
|
||||
instance().m_registeredHandlers.push_back(handler);
|
||||
}
|
||||
|
||||
private:
|
||||
std::terminate_handler m_previousHandler;
|
||||
std::vector<std::function<void(std::exception_ptr)>> m_registeredHandlers;
|
||||
|
||||
GlobalHandler();
|
||||
void handleException(const std::exception_ptr&);
|
||||
|
||||
static GlobalHandler& instance();
|
||||
static void terminateHandler();
|
||||
|
||||
};
|
||||
|
||||
} // namespace exceptions
|
||||
} // namespace utils
|
||||
} // namespace ddkit
|
||||
Reference in new issue
Block a user