Skip to content

Commit 8bdef9c

Browse files
committed
Save HR data on failfast
1 parent bb5250a commit 8bdef9c

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lib/Common/Core/Assertions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,16 @@ extern int IsInAssert;
7777

7878
#ifdef DBG
7979
#define AssertOrFailFast(x) Assert(x)
80+
#define AssertOrFailFastHR(x, hr) Assert(x)
8081
#define AssertOrFailFastMsg(x, msg) AssertMsg(x, msg)
82+
#define AssertOrFailFastMsgHR(x, msg) AssertOrFailFastHR(x, hr)
8183
#define AnalysisAssertOrFailFast(x) AnalysisAssert(x)
8284
#define AnalysisAssertOrFailFastMsg(x, msg) AnalysisAssertMsg(x, msg)
8385
#else
86+
#define AssertOrFailFastHR(x, hr) do { if (!(x)) { Js::Throw::FatalInternalError(hr); } } while (false)
8487
#define AssertOrFailFast(x) do { if (!(x)) { Js::Throw::FatalInternalError(); } } while (false)
8588
#define AssertOrFailFastMsg(x, msg) AssertOrFailFast(x)
89+
#define AssertOrFailFastMsgHR(x, msg) AssertOrFailFastHR(x, hr)
8690
#define AnalysisAssertOrFailFast(x) AssertOrFailFast(x)
8791
#define AnalysisAssertOrFailFastMsg(x, msg) AssertOrFailFast(x)
8892
#endif

lib/Common/Exceptions/Throw.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ namespace Js {
6666
#if defined(GENERATE_DUMP) && defined(STACK_BACK_TRACE)
6767
THREAD_LOCAL StackBackTrace * Throw::stackBackTrace = nullptr;
6868
#endif
69-
void Throw::FatalInternalError()
69+
void Throw::FatalInternalError(HRESULT hr)
7070
{
7171
int scenario = 2;
72-
ReportFatalException(NULL, E_FAIL, Fatal_Internal_Error, scenario);
72+
ReportFatalException(NULL, hr, Fatal_Internal_Error, scenario);
7373
}
7474

7575
void Throw::FatalInternalErrorEx(int scenario)

lib/Common/Exceptions/Throw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Js {
1919
static void __declspec(noreturn) StackOverflow(ScriptContext *scriptContext, PVOID returnAddress);
2020
static void __declspec(noreturn) NotImplemented();
2121
static void __declspec(noreturn) InternalError();
22-
static void __declspec(noreturn) FatalInternalError();
22+
static void __declspec(noreturn) FatalInternalError(HRESULT hr = E_FAIL);
2323
static void __declspec(noreturn) FatalInternalErrorEx(int scenario);
2424
static void __declspec(noreturn) FatalInternalGlobalizationError();
2525

@@ -163,7 +163,7 @@ namespace Js {
163163
else if (FAILED(hr)) \
164164
{ \
165165
/* Intended to be the inverse of E_FAIL in CATCH_UNHANDLED_EXCEPTION */ \
166-
AssertOrFailFast(false); \
166+
AssertOrFailFastHR(false, hr); \
167167
}
168168

169169
#define CATCH_UNHANDLED_EXCEPTION(hr) \

0 commit comments

Comments
 (0)