Open In App

Node.js process.report.reportOnFatalError Property

Last Updated : 24 Mar, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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:

index.js




// 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:

index.js




// 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



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads