isolating error actions

This commit is contained in:
Marcos Slomp
2025-12-02 10:56:38 -08:00
parent f6965c62a9
commit 95658d532e

View File

@@ -20,6 +20,18 @@ struct Session {
CONTROLTRACE_ID handle = 0;
};
static void ETWErrorAction(ULONG error_code, const char* message, int length) {
#ifdef TRACY_HAS_CALLSTACK
tracy::InitCallstackCritical();
TracyMessageCS(message, length, tracy::Color::Red4, 60);
#else
TracyMessageC(message, length, tracy::Color::Red4);
#endif
#ifdef __cpp_exceptions
// TODO: should we throw an exception?
#endif
}
static ULONG ETWError(ULONG result) {
if (result == ERROR_SUCCESS)
return result;
@@ -35,11 +47,7 @@ static ULONG ETWError(ULONG result) {
sizeof(message)-written,
NULL
);
tracy::InitCallstackCritical();
TracyMessageCS(message, written, tracy::Color::Red4, 60);
#ifdef __cpp_exceptions
// TODO: should we throw an exception?
#endif
ETWErrorAction(result, message, written);
return result;
}