For some reason that I can't find out, this simple piece of code doesn't work.
new Promise(function (resolve, reject) {
resolve();
}).then(function() {
console.log("then: ")
}).error(function(err) {
console.log("err: ", err)
})
It gives me
Uncaught TypeError: (intermediate value).then(...).error is not a function
If I replace error
with catch
, it runs fine. I would prefer not to catch though.
What am I missing here?
Making this comment an answer since it turned out to be the solution...
If .error()
does not exist, then you probably aren't using a Bluebird promise since .error()
is not part of the Promise standard so you may just have a built-in promise instead of a Bluebird promise.
Check to make sure that Bluebird is properly included in your project.