catch Method

Attaches a callback for only the rejection of the Promise.

catch<TResult>(onrejected?: "null" | (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>

@returns A Promise for the completion of the callback.

Parameter Type Description
onrejected "null" | (reason: any) => TResult | PromiseLike<TResult> The callback to execute when the Promise is rejected.

Returns - Promise<T | TResult>

A Promise for the completion of the callback.

Defined in

Last Updated: 17 December, 2024