Skip to content

emitAsyncErrorEvent

Emits an asynchronous error event.

When a collection window is open (see startCollectingUnhandledAsyncErrors) the error is collected as unhandled unless it is ignored — either because shouldIgnore is true or an startAsyncErrorIgnoreContext scope is active. A registered consumer handler deliberately does not exempt the error: in production it shows the user a Notice, which is not a test asserting that the error was expected. startAsyncErrorIgnoreContext is the single, explicit opt-out.

Import:

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

Signature:

function emitAsyncErrorEvent(asyncError: unknown, shouldIgnore: boolean): void

Parameters:

ParameterTypeDescription
asyncErrorunknownThe error to emit as an asynchronous error event.
shouldIgnorebooleanWhether to treat the error as expected and never collect it as unhandled, regardless of the active ignore context. Used to carry the schedule-time ignore decision of a deferred fire-and-forget rejection.

Returns: void


Links to this page: