Skip to content

invokeAsyncSafely

Invokes a Promise and safely handles any errors by catching them and emitting an async error event.

Import:

import { invokeAsyncSafely } from '@mnaoumov/typescript-lib/async';

Signature:

function invokeAsyncSafely(asyncFunction: () => unknown, stackTrace: string | undefined): void

Parameters:

Parameter Type Description
asyncFunction () => unknown The asynchronous function to invoke safely.
stackTrace string | undefined The stack trace of the source function.

Returns: void