'.then(...).catch' not a function
See original GitHub issueHi,
I just encountered this issue while working with promise queries. For example:
users.find({})
.then(data => {
res.json(data);
})
.catch(err => {
errors.db(err);
});
works fine if only the .then(...)
is present, but catch
gets reported as not being a function.
Issue Analytics
- State:
- Created 8 years ago
- Comments:6
Top Results From Across the Web
TypeError: promise.then(...).then(...).then(...).then(...).catch is ...
It looks like you're using Mongoose, which returns its own Promise, not the ES6 promise which includes a catch function.
Read more >Promise.prototype.catch() - JavaScript - MDN Web Docs
The catch() method of a Promise object schedules a function to be called when the promise is rejected. It immediately returns an equivalent ......
Read more >Using .then(), .catch(), .finally() to Handle Errors in Javascript ...
It is common practice to learn the .then() method with Promises. .then takes a callback function and returns another Promise (!) and you...
Read more >TypeError: then is not a function in JavaScript | bobbyhadz
The "then is not a function" error occurs when the then() method is called on a value that is not a promise. To...
Read more >Catch is not a function - Odoo
I have this nested functions but it only called the first 2 functions and then skipped the others. Add it is too fast...
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 FreeTop 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
Top GitHub Comments
This works. However,
.error(fn)
does not work either for me - error gets replaced byusers.findOne(...).then(...).error is not a function
.fixed in #132 🎉