The process object is a global that provides information about, and control over, the current Node.js process. As a global, it is always available to Node.js applications without using require(). It can also be explicitly accessed using require() as shown below:
const process = require('process');If process.report.reportOnFatalError is true, a diagnostic report is generated on fatal errors, such as out-of-memory errors or failed C++ assertions.
Syntax:
process.report.reportOnFatalError
Parameters: This property does not accept any parameter.
Return Value: This property returns a boolean value.
Below examples illustrate the use of the process.report.reportOnFatalError property in Node.js:
Example 1:
// Node.js program to demonstrate the
// process.report.reportOnFatalError
// Include process module
const process = require('process');
// Printing process.report.reportOnFatalError
// property value
console.log(`Report on fatal error:
${process.report.reportOnFatalError}`);
Run the index.js file using the following command:
node index.js
Output:
Report on fatal error: false
Example 2:
// Node.js program to demonstrate the
// process.report.reportOnFatalError
// Include process module
const process = require('process');
process.report.reportOnFatalError = true;
// Printing process.report.reportOnFatalError
// property value
console.log(`Report on fatal error:
${process.report.reportOnFatalError}`);
Run the index.js file using the following command:
node index.js
Output:
Report on fatal error: true
Reference: https://nodejs.org/api/process.html#process_process_report_reportonfatalerror