From 3504831f0f1fd4ef05ea584eccc499a409bc406a Mon Sep 17 00:00:00 2001 From: legendecas Date: Mon, 19 Apr 2021 23:38:34 +0800 Subject: [PATCH] fixup!: fix checks with V8_ENABLE_CHECKS --- lib/internal/process/execution.js | 11 +++++++---- .../test-report-uncaught-exception-primitives.js | 1 + test/report/test-report-uncaught-exception-symbols.js | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js index e370770643ca6f..e2d9898012d2d7 100644 --- a/lib/internal/process/execution.js +++ b/lib/internal/process/execution.js @@ -152,10 +152,13 @@ function createOnGlobalUncaughtException() { try { const report = internalBinding('report'); if (report != null && report.shouldReportOnUncaughtException()) { - report.writeReport(er ? er.message : 'Exception', - 'Exception', - null, - er ? er : {}); + report.writeReport( + typeof er?.message === 'string' ? + er.message : + 'Exception', + 'Exception', + null, + er ? er : {}); } } catch {} // Ignore the exception. Diagnostic reporting is unavailable. } diff --git a/test/report/test-report-uncaught-exception-primitives.js b/test/report/test-report-uncaught-exception-primitives.js index 5b5e8f3893246b..75a05f335cf2e2 100644 --- a/test/report/test-report-uncaught-exception-primitives.js +++ b/test/report/test-report-uncaught-exception-primitives.js @@ -17,6 +17,7 @@ process.on('uncaughtException', common.mustCall((err) => { assert.strictEqual(reports.length, 1); console.log(reports[0]); helper.validate(reports[0], [ + ['header.event', 'Exception'], ['javascriptStack.message', `${exception}`], ]); })); diff --git a/test/report/test-report-uncaught-exception-symbols.js b/test/report/test-report-uncaught-exception-symbols.js index e86a243097ebdd..5997d0e0898ac0 100644 --- a/test/report/test-report-uncaught-exception-symbols.js +++ b/test/report/test-report-uncaught-exception-symbols.js @@ -17,6 +17,7 @@ process.on('uncaughtException', common.mustCall((err) => { assert.strictEqual(reports.length, 1); console.log(reports[0]); helper.validate(reports[0], [ + ['header.event', 'Exception'], ['javascriptStack.message', 'Symbol(foobar)'], ]); }));