Skip to main content
Process.setUncaughtExceptionCaptureCallback - process - Node documentation
method Process.setUncaughtExceptionCaptureCallback

Usage in Deno

import { type Process } from "node:process";
Process.setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void

The process.setUncaughtExceptionCaptureCallback() function sets a function that will be invoked when an uncaught exception occurs, which will receive the exception value itself as its first argument.

If such a function is set, the 'uncaughtException' event will not be emitted. If --abort-on-uncaught-exception was passed from the command line or set through v8.setFlagsFromString(), the process will not abort. Actions configured to take place on exceptions such as report generations will be affected too

To unset the capture function, process.setUncaughtExceptionCaptureCallback(null) may be used. Calling this method with a non-null argument while another capture function is set will throw an error.

Using this function is mutually exclusive with using the deprecated domain built-in module.

Parameters

cb: ((err: Error) => void) | null

Return Type

void