addErrorHandler
Adds an error handler to a Promise that catches any errors and emits an async error event.
Import:
import { addErrorHandler } from 'obsidian-dev-utils/async';Signature:
function addErrorHandler(asyncFn: () => Promise<unknown>, stackTrace: string | undefined): Promise<void>Parameters:
| Parameter | Type | Description |
|---|---|---|
asyncFn | () => Promise<unknown> | The asynchronous function to add an error handler to. |
stackTrace | string | undefined | The stack trace of the source function. |
Returns: Promise<void> — A Promise that resolves when the asynchronous function completes or emits async error event.