JavaScript Promise catch()

Definition and Usage

catch() The method provides a callback function.

The callback is a function that will be executed when a Promise is rejected.

Example

myPromise.catch(x => myDisplay(x));

Try It Yourself

Syntax

promise.catch(rejected())

Parameters

Parameters Description
rejected() Function to be executed when the Promise is rejected.

Return Value

Type Description
Object New Promise Object.

Browser Support

catch() It is a feature of ECMAScript 6 (ES6).

Since June 2017, ES6 (JavaScript 2015) is supported in all modern browsers:

Chrome Edge Firefox Safari Opera
Chrome 51 Edge 15 Firefox 54 Safari 10 Opera 38
May 2016 April 2017 June 2017 September 2016 June 2016

catch() Not supported by Internet Explorer.