Skip to content

Commit be59b67

Browse files
committed
fixup!: fix checks with V8_ENABLE_CHECKS
1 parent 386f07b commit be59b67

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

lib/internal/process/execution.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,13 @@ function createOnGlobalUncaughtException() {
152152
try {
153153
const report = internalBinding('report');
154154
if (report != null && report.shouldReportOnUncaughtException()) {
155-
report.writeReport(er ? er.message : 'Exception',
156-
'Exception',
157-
null,
158-
er ? er : {});
155+
report.writeReport(
156+
typeof er?.message === 'string' ?
157+
er.message :
158+
'Exception',
159+
'Exception',
160+
null,
161+
er ? er : {});
159162
}
160163
} catch {} // Ignore the exception. Diagnostic reporting is unavailable.
161164
}

src/node_report.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ using node::TIME_TYPE;
3939
using node::worker::Worker;
4040
using v8::Array;
4141
using v8::Context;
42+
using v8::HandleScope;
4243
using v8::HeapSpaceStatistics;
4344
using v8::HeapStatistics;
4445
using v8::Isolate;
@@ -545,6 +546,7 @@ static void PrintJavaScriptErrorStack(JSONWriter* writer,
545546
Local<Value> error,
546547
const char* trigger) {
547548
TryCatch try_catch(isolate);
549+
HandleScope scope(isolate);
548550
Local<Context> context = isolate->GetCurrentContext();
549551
std::string ss = "";
550552
if ((!strcmp(trigger, "FatalError")) ||

test/report/test-report-uncaught-exception-primitives.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ process.on('uncaughtException', common.mustCall((err) => {
1717
assert.strictEqual(reports.length, 1);
1818
console.log(reports[0]);
1919
helper.validate(reports[0], [
20+
['header.event', 'Exception'],
2021
['javascriptStack.message', `${exception}`],
2122
]);
2223
}));

test/report/test-report-uncaught-exception-symbols.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ process.on('uncaughtException', common.mustCall((err) => {
1717
assert.strictEqual(reports.length, 1);
1818
console.log(reports[0]);
1919
helper.validate(reports[0], [
20+
['header.event', 'Exception'],
2021
['javascriptStack.message', 'Symbol(foobar)'],
2122
]);
2223
}));

0 commit comments

Comments
 (0)