Warning: a promise was rejected with a non-error: [object Array]
See original GitHub issueWorking 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:
- Created 7 years ago
- Reactions:7
- Comments:8 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
v3.0.0 released with the above API! 🚢
The issue is in bluebird. https://github.com/petkaantonov/bluebird/issues/990 https://github.com/petkaantonov/bluebird/commit/e77224c191dc8942eb27c6ea95dce8e3fec8a570