catch Method

Attaches a callback for only the rejection of the Promise.

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

@returns A Promise for the completion of the callback.

Parameter Type Description
onrejected | (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: 16 April, 2024