MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / ReportException

Function ReportException

IntelPresentMon/CommonUtilities/Exception.cpp:82–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 }
81
82 std::pair<std::string, std::optional<PM_STATUS>> ReportException(std::string note, std::exception_ptr pEx) noexcept
83 {
84 if (!pEx) {
85 pEx = std::current_exception();
86 }
87 const auto concat = [&](std::string what) {
88 if (!note.empty()) {
89 return note + "\n" + what;
90 }
91 else {
92 return what;
93 }
94 };
95 if (pEx) {
96 try {
97 std::rethrow_exception(pEx);
98 }
99 catch (const pmon::util::Exception& e) {
100 try {
101 if (e.HasPmStatus()) {
102 return { concat(std::format("[{}] {}", typeid(e).name(), e.what())), e.GeneratePmStatus() };
103 }
104 else {
105 return { concat(std::format("[{}] {}", typeid(e).name(), e.what())), std::nullopt };
106 }
107 }
108 catch (...) { return {}; }
109 }
110 catch (const std::exception& e) {
111 try { return { concat(std::format("[{}] {}", typeid(e).name(), e.what())), std::nullopt }; }
112 catch (...) { return {}; }
113 }
114 catch (...) {
115 return { concat("Unrecognized exception"), std::nullopt };
116 }
117 }
118 return { concat("No exception in flight"), std::nullopt };
119 }
120
121 PM_STATUS GeneratePmStatus(std::exception_ptr pEx) noexcept
122 {

Callers 15

HandlePclEventMethod · 0.85
PrecisionWaiterMethod · 0.85
WaitWithBufferMethod · 0.85
GetErrorDescriptionFunction · 0.85
AsOptionalMethod · 0.85
ExistsMethod · 0.85
DeleteMethod · 0.85
RegistryMethod · 0.85
EntryMarshallInjectorMethod · 0.85
ChannelFlusherMethod · 0.85
InjectDefaultChannelFunction · 0.85

Calls 4

emptyMethod · 0.80
whatMethod · 0.80
HasPmStatusMethod · 0.45
GeneratePmStatusMethod · 0.45

Tested by 1

~ConnectedTestProcessMethod · 0.68