Permalink
Browse files

process: simplify report uncaught exception logic

This commit combines two if statements into a single if
statement. Another if statement is replaced with a ternary.

PR-URL: #25744
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
  • Loading branch information...
cjihrig committed Jan 27, 2019
1 parent 4d19300 commit dc1d331403feb3b9d1ca1a2bd306ca7428414ed8
Showing with 8 additions and 13 deletions.
  1. +8 −13 lib/internal/process/execution.js
@@ -105,19 +105,14 @@ function createFatalException() {
if (er == null || er.domain == null) {
try {
const report = internalBinding('report');
if (report != null) {
if (require('internal/options').getOptionValue(
'--experimental-report')) {
const config = {};
report.syncConfig(config, false);
if (Array.isArray(config.events) &&
config.events.includes('exception')) {
if (er) {
report.onUnCaughtException(er.stack);
} else {
report.onUnCaughtException(undefined);
}
}
if (report != null &&
require('internal/options')
.getOptionValue('--experimental-report')) {
const config = {};
report.syncConfig(config, false);
if (Array.isArray(config.events) &&
config.events.includes('exception')) {
report.onUnCaughtException(er ? er.stack : undefined);
}
}
} catch {} // NOOP, node_report unavailable.

0 comments on commit dc1d331

Please sign in to comment.