Index: src/plugin/PluginDebug.cpp |
=================================================================== |
--- a/src/plugin/PluginDebug.cpp |
+++ b/src/plugin/PluginDebug.cpp |
@@ -16,11 +16,53 @@ |
*/ |
#include "PluginStdAfx.h" |
- |
#include "PluginDebug.h" |
+#include "Exception.h" |
#include "PluginMutex.h" |
#include "PluginSettings.h" |
+#if (defined ENABLE_DEBUG_INFO) |
+struct EntryPointHandlers |
+{ |
+ static void Unknown(std::string name) |
+ { |
+ CPluginDebug::Debug("Unknown exception in catch-all for entry point " + name); |
+ } |
+ static void Exception(std::exception& ex, std::string name) |
+ { |
+ CPluginDebug::DebugOrdinaryException(ex, |
+ PLUGIN_ERROR_ENTRY_POINT, PLUGIN_ERROR_ENTRY_POINT_CATCHALL_EXCEPTION, |
+ "std::exception in catch-all for entry point " + name); |
+ } |
+ static void LogicError(std::logic_error& ex, std::string name) |
+ { |
+ CPluginDebug::DebugOrdinaryException(ex, |
+ PLUGIN_ERROR_ENTRY_POINT, PLUGIN_ERROR_ENTRY_POINT_CATCHALL_EXCEPTION, |
+ "std::logic_error in catch-all for entry point " + name); |
+ } |
+ static void RuntimeError(std::runtime_error& ex, std::string name) |
+ { |
+ CPluginDebug::DebugOrdinaryException(ex, |
+ PLUGIN_ERROR_ENTRY_POINT, PLUGIN_ERROR_ENTRY_POINT_CATCHALL_EXCEPTION, |
+ "std::runtime_error in catch-all for entry point " + name); |
+ } |
+ static void SystemError(std::system_error& ex, std::string name) |
+ { |
+ CPluginDebug::DebugSystemException(ex, |
+ PLUGIN_ERROR_ENTRY_POINT, PLUGIN_ERROR_ENTRY_POINT_CATCHALL_EXCEPTION, |
+ "std::system_error in catch-all for entry point " + name); |
+ } |
+}; |
+#endif |
+ |
+void EntryPointExceptionDefault(std::string name) |
Oleksandr
2015/03/05 07:18:55
I'd prefer 'DefaultExceptionHander' instead. This
Eric
2015/03/05 14:58:04
As a small point of language, there's no need to u
|
+{ |
+#if (defined ENABLE_DEBUG_INFO) |
+ CatchAllVoid<EntryPointHandlers>::Handler(name); |
+#endif |
+} |
+ |
+ |
class CPluginDebugLock : public CPluginMutex |
{ |
@@ -49,6 +91,14 @@ |
DEBUG_ERROR_LOG(ex.code().value(), errorId, errorSubid, message); |
} |
+void CPluginDebug::DebugOrdinaryException(const std::exception& ex, int errorId, int errorSubid, const std::string& description) |
+{ |
+ std::string message = description + ", " + ex.what(); |
+ DEBUG_ERROR_LOG(0, errorId, errorSubid, message); |
+} |
+ |
+ |
+ |
#ifdef ENABLE_DEBUG_INFO |
void DebugLegacy(const CString& text, DWORD dwProcessId, DWORD dwThreadId) |