catch Method

Attaches a callback for only the rejection of the Promise.

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

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: 12 June, 2024