question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Runner rejects Promise with non-error

See original GitHub issue

In runner.js there’s a Promise.reject method call with no arguments:

https://github.com/express-validator/express-validator/blob/96a393f143e7c4ce26676b3edd5f4924bcb661d9/check/runner.js#L15

If we change the default Promise construct to Bluebird, it prints warnings to the console about the usage of promise rejection without an error.

http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-rejected-with-a-non-error

eg:

// file1.js
// Change default Promise to Bluebird
const Bluebird = require('bluebird');
global.Promise = Bluebird;

// file2.js
router
  .route('/stats/:userId')
  // GET /stats/:userId
  .get([check('userId').isInt()], fooController.barBaz);

Is it desirable to stick with Promises/A+ or should we fix and play better with Bluebird?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gustavohenkecommented, Jun 29, 2019

👋 this has been fixed with v6.0.0!

0reactions
lock[bot]commented, Aug 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Promise.reject() - JavaScript - MDN Web Docs
The Promise.reject() method returns a Promise object that is rejected with a given reason.
Read more >
Error handling with promises - The Modern JavaScript Tutorial
In the task an error is thrown form inside the promise and promise is never settled neither with a resolve nor reject. The...
Read more >
Promise reject not triggering - Stack Overflow
The Promise returned from fetch() won't reject on HTTP error status even if the response is an HTTP 404 or 500. Instead, it...
Read more >
Rejected promise not throwing an uncaught exception with ...
Turns out converting a rejected promise to an exception is pretty hard, because exceptions are automatically converted to rejected promise. One ...
Read more >
Reject a Promise and Handle Errors (How To) - Treehouse
If an error occurs, the promise status changes from "pending" to a "rejected" (or failed) state. Promises give you the opportunity to handle...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found