Skip to content

Commit ef065f4

Browse files
committed
Use the error HR for the exception code for debug attach/detech fatal error
1 parent 60fe018 commit ef065f4

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

lib/Common/Exceptions/ReportError.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ _NOINLINE void FromDOM_NoScriptScope_fatal_error()
114114
ReportFatalException(NULL, E_UNEXPECTED, EnterScript_FromDOM_NoScriptScope, scenario);
115115
}
116116

117-
_NOINLINE void Debugger_AttachDetach_fatal_error()
117+
_NOINLINE void Debugger_AttachDetach_fatal_error(HRESULT hr)
118118
{
119119
int scenario = 5;
120-
ReportFatalException(NULL, E_UNEXPECTED, Fatal_Debugger_AttachDetach_Failure, scenario);
120+
ReportFatalException(NULL, hr, Fatal_Debugger_AttachDetach_Failure, scenario);
121121
}
122122

123123
_NOINLINE void EntryExitRecord_Corrupted_fatal_error()

lib/Common/Exceptions/ReportError.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void LargeHeapBlock_Metadata_Corrupted(
6464
#endif
6565

6666
void FromDOM_NoScriptScope_fatal_error();
67-
void Debugger_AttachDetach_fatal_error();
67+
void Debugger_AttachDetach_fatal_error(HRESULT hr);
6868

6969
#ifndef DISABLE_SEH
7070
// RtlReportException is available on Vista and up, but we cannot use it for OOB release.

lib/Common/Exceptions/Throw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,4 @@ namespace Js {
256256
catch (ex) \
257257
{
258258

259-
#define DEBUGGER_ATTACHDETACH_FATAL_ERROR_IF_FAILED(hr) if (hr != S_OK) Debugger_AttachDetach_fatal_error();
259+
#define DEBUGGER_ATTACHDETACH_FATAL_ERROR_IF_FAILED(hr) if (hr != S_OK) Debugger_AttachDetach_fatal_error(hr);

lib/Jsrt/JsrtDiag.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ CHAKRA_API JsDiagStartDebugging(
8787
debugContext->SetHostDebugContext(jsrtDebugManager);
8888
}
8989

90-
if (FAILED(scriptContext->OnDebuggerAttached()))
90+
HRESULT hr;
91+
if (FAILED(hr = scriptContext->OnDebuggerAttached()))
9192
{
92-
Debugger_AttachDetach_fatal_error(); // Inconsistent state, we can't continue from here
93+
Debugger_AttachDetach_fatal_error(hr); // Inconsistent state, we can't continue from here
9394
return JsErrorFatal;
9495
}
9596

@@ -129,9 +130,10 @@ CHAKRA_API JsDiagStopDebugging(
129130
{
130131
Assert(scriptContext->IsScriptContextInDebugMode());
131132

132-
if (FAILED(scriptContext->OnDebuggerDetached()))
133+
HRESULT hr;
134+
if (FAILED(hr = scriptContext->OnDebuggerDetached()))
133135
{
134-
Debugger_AttachDetach_fatal_error(); // Inconsistent state, we can't continue from here
136+
Debugger_AttachDetach_fatal_error(hr); // Inconsistent state, we can't continue from here
135137
return JsErrorFatal;
136138
}
137139

0 commit comments

Comments
 (0)