Skip to main content

fatal_report

Function fatal_report 

Source
pub fn fatal_report(msg: &str) -> String
Expand description

What node writes to stderr for the exception msg that is ending the process — ReportFatalException (src/node_errors.cc), fed by fatalExceptionStackEnhancers (lib/internal/errors.js):

  • an object (an Error or anything else) prints the source arrow — the file:line header, the source line and a ^ under the raise, then a blank line — followed by util.inspect(err, { customInspect: false, depth: 5 }), which for an error is its stack plus any own properties;
  • a primitive prints a blank line, the arrow, the value, and the --trace-uncaught hint (AppendExceptionLine writes the arrow itself for a non-error);
  • both end with a blank line and Node.js <version>.

The arrow points where the exception was thrown, except for an unhandled rejection, whose error has no throw site and is shown where it was created. node colours the inspected error when stderr is a terminal; this runtime’s util.inspect has no colours, so it never does.