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.

Warning: a promise was rejected with a non-error: [object Array]

See original GitHub issue

Working with native Promise i got this warning.

Warning: a promise was rejected with a non-error: [object Array]

If validation errors exists, onReject function receive an array of this errors. https://github.com/ctavan/express-validator/blob/master/lib/express_validator.js#L155

Can we define own “class” of error? ex. ExpressValidationErrors which will contain property ._list (array) of errors. And .all() will return this list.

req.asyncValidationErrors().catch(errors => {
  req.flash('errors', errors.all());
  renderEdit(res);
});

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:7
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
gustavohenkecommented, Nov 24, 2016

v3.0.0 released with the above API! 🚢

Read more comments on GitHub >

github_iconTop Results From Across the Web

Promise rejected with non-error warning - Stack Overflow
This just means that the error that was thrown is not an instanceof Error . For example, the following is not an error,...
Read more >
Warning Explanations - Bluebird.js
Warning: a promise was rejected with a non -error ... Due to a historic mistake in JavaScript, the throw statement is allowed to...
Read more >
Promise.reject() - JavaScript - MDN Web Docs
The Promise.reject() method returns a Promise object that is rejected with a given reason.
Read more >
Why Promise.all doesn't reject when a non-promise throws an ...
In this approach, we will create a then() method inside the non-promise array element and throw the error inside the method. This is...
Read more >
Error handling with promises
The code of a promise executor and promise handlers has an "invisible try..catch " around it. If an exception happens, it gets caught...
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