Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/plugin/PluginUtil.cpp

Issue 6032593782833152: Issue 1173 - proposal for entry point (Closed)
Patch Set: Created Jan. 13, 2015, 11:40 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/plugin/PluginUtil.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+}
+
« no previous file with comments | « src/plugin/PluginUtil.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld