type alias ErrorHandler

Optionally change or suppress the error before it is thrown. Note that this will only be called if either one or both of error and stderrData is defined (non-null).

This is a chance to throw a custom error or to suppress throwing an error. You can pass any type of data from the stderr handler to the error handler since you own both functions.

Throw the error you want to be thrown from the process. If you want to suppress the error, just don't throw an error and return normally. It is good practice to set the error cause when wrapping a thrown error.

Type Parameters

Definition

(
error?: Error,
stderrData?: S,
) => void

Usage

import { type ErrorHandler } from ".";