Skip to content

startCollectingUnhandledAsyncErrors

Opens a window in which async errors emitted outside an ignore context are collected as unhandled (see emitAsyncErrorEvent), discarding anything collected by a previous window.

Intended for the test harness only: the per-test setup opens a window before each test and empties it after each test via drainCollectedUnhandledAsyncErrors, closing it for good with stopCollectingUnhandledAsyncErrors once the file’s last test has run. In production no window is open, so emitting an async error carries no bookkeeping overhead.

Import:

import { startCollectingUnhandledAsyncErrors } from 'obsidian-dev-utils/error';

Signature:

function startCollectingUnhandledAsyncErrors(): void

Returns: void


Links to this page: