Index: src/plugin/PluginUtil.cpp |
diff --git a/src/plugin/PluginUtil.cpp b/src/plugin/PluginUtil.cpp |
index a077d4e7e6058fa0cd1361d0ace6ad8f0e3597d8..85f9f7e5db26ffad2bb9bf7d0f7d19272166fe75 100644 |
--- a/src/plugin/PluginUtil.cpp |
+++ b/src/plugin/PluginUtil.cpp |
@@ -28,3 +28,38 @@ std::wstring FileUrl(const std::wstring& path) |
std::replace(url.begin(), url.end(), L'\\', L'/'); |
return L"file:///" + url; |
} |
+ |
+bool EntryPoint(const std::function<void()>& functionBody) |
+{ |
+ bool withoutException = true; |
+ if (!functionBody) |
+ { |
+ return withoutException; |
+ } |
+ try |
+ { |
+ functionBody(); |
+ } catch(...) |
+ { |
+ withoutException = false; |
+ } |
+ return withoutException; |
+} |
+ |
+HRESULT EntryPointWithHResult(const std::function<HRESULT()>& functionBody) |
+{ |
+ HRESULT retValue = S_OK; |
+ if (!functionBody) |
+ { |
+ return retValue; |
+ } |
+ try |
+ { |
+ functionBody(); |
+ } catch(...) |
+ { |
+ retValue = E_FAIL; |
+ } |
+ return retValue; |
+} |
+ |