Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
Does using a catch on then create an extra promise?

This is how I understand the promise syntax to work:

promise.then((value) => {
    // handle async return
}, (error) => {
    console.log(error);
});

The promise can be fulfilled or rejected and you declare two closures separated by a comma where the first one handles success and the second handles failure. But all or most of the code I see doesn't use this syntax; it uses catch.

promise.then((value) => {
    // handle async return
}).catch((error) => {
    console.log(error);
});

However, I've read that catch() itself creates a new promise. Is that true? Because, as far as I understand it, catch is supposed to be the final stop of a process when an error is thrown, or does it work differently in JavaScript?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch

YES.

p1.then(function(value) {
  console.log(value); // "Success!"
  throw new Error('oh, no!');
}).catch(function(e) {
  console.error(e.message); // "oh, no!"
}).then(function(){
  console.log('after a catch the chain is restored');
}, function () {
  console.log('Not fired due to the catch');
});

The return value of catch is thenable.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!