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

221
Views
DeprecationWarning: los rechazos de promesa no controlados están en desuso

Recibo este error en mi código y no sé cómo solucionarlo.

 DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Mi código hasta ahora:

 router.post('/users/*', (req, res) => { User.create(new User({ email: req.body.identity.user_email, authUserId: req.body.identity.user_id })) res.json(console.log("User Created")) }) router.get('/users/:id', (req, res, next) => { User.findOne({authUserId: req.params.id}, (err, userr) => { if(err) { return next(err); } else if (userr) { res.json(userr.email); } else { res.json(null) } }); });

¿Puede alguien ayudarme a deshacerme de este error? ¡Gracias por adelantado! :)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Supongo que el punto de entrada de su aplicación es app.js Entonces, como está reenviando el error como return next(err); , debe haber alguien que atrape eso y lo maneje.

generalmente coloco el controlador en app.js antes de la función de escucha-

 // development error handler // will print stacktrace if (app.get('env') === 'development') { app.use(function(err, req, res, next) { res.status(err.status || 500); res.render('error', { message: err.message, error: err }); }); } // production error handler // no stacktraces leaked to user app.use(function(err, req, res, next) { res.status(err.status || 500); res.render('error', { message: err.message, error: {} }); });
over 4 years ago · Santiago Trujillo 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!