Skip to content

Commit

Permalink
process: simplify report uncaught exception logic
Browse files Browse the repository at this point in the history
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 authored and addaleax committed Feb 1, 2019
1 parent 454278a commit cc253b5
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions lib/internal/process/execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cc253b5

Please sign in to comment.