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

181
Views
Is it necessary to include the argument in the callback function of Promise.prototype.catch()?

Background

According to the MDN docs, Promise.prototype.catch() takes a parameter called onRejected, which is a function that is called when the Promise is rejected. (Internally, this calls Promise.prototype.then(undefined, onRejected).)

According to the docs, onRejected “has” one parameter, reason, which is the rejection reason. In the examples given, this parameter is always present.

E.g.,

p.catch(function(e) {
  console.error(e);
})

Question

I am writing code where I do not want to use the reason parameter, so something like this:

p.catch(function(e) {
  foo();
})

Is it better practice to leave in the e parameter, since according to the docs onRejected is supposed to have it? (ESLint will also complain about this).

Or is it common practice to remove it? As in

p.catch(function() {
  foo();
})

PS: I know about optional catch binding, but that is for try-catch blocks.

about 4 years ago · Juan Pablo Isaza
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!