catch() returns a Promise and deals with rejected cases only
prerequisites for understanding
return a fulfilled promise, to pass a test
reminder: the test passes when a fulfilled promise is returned
catch method basics
is an instance method
catches only promise rejections
returns a new promise
converts it`s return value into a promise
the first parameter is the rejection reason
multiple catches
only the first catch is called
if a catch throws, the next catch catches it
Links
A short description of how `catch` works.
The actual chapter about `catch`, you need to dive in from here.
The description of the actual flow of `catch`.
Required Knowledge
Related Katas
Promise
- basics
- creation
- chaining then()
- the API
- promise.catch()
Difficulty Level
INTERMEDIATE
First Published
15 March 2015
Stats
9 tests to solve