Skip to content

ignoreError<T>

Ignores an error that is thrown by an asynchronous function.

Import:

import { ignoreError } from 'obsidian-dev-utils/async';

Signature:

function ignoreError(promise: Promise<T>, fallbackValue: T | undefined): Promise<void | T>

Parameters:

ParameterTypeDescription
promisePromise<T>The promise to ignore the error of.
fallbackValueT | undefinedThe value to return if an error is thrown.

Returns: Promise<void | T> — A Promise that resolves with the value returned by the asynchronous function or the fallback value if an error is thrown.