MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / Try

Function Try

Tools/Tool.hpp:37–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36 template <typename Exception, typename Fct>
37 decltype(auto)
38 Try(Fct fct, std::function<std::string(const std::string&)> buildErrorMsg)
39 {
40 std::string error;
41 try
42 {
43 return fct();
44 }
45 catch (const std::exception& e)
46 {
47 error = e.what();
48 }
49 catch (...)
50 {
51 error = "Unknow";
52 }
53
54 throw Exception(buildErrorMsg(error));
55 }
56
57 TOOLS_DLL std::filesystem::path GetExecutableFolder();
58

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected