I'm using IcedCoffeeScript.
I want to write this:
User.find(id).always esc done or await User.find(id).always defer e, user
But Promise#always is deprecated in when.js.
Is there another way?
Promise#always is deprecated in when.js and will be removed in an upcoming version.
However, promise.always(onFulfilledOrRejected, onProgress) is nothing but a shortcut for .then(onFulfilledOrRejected, onFulfilledOrRejected, onProgress). So instead of using
.always(handler)
You will have to use
.then(handler, handler)
If may affect your code if you were using inline functions for .always as with .then it would be better to extract them as separate functions.
Authors of when.js recommend using promise.ensure instead of promise.always. More details here.
promise.ensureis safer in that it cannot transform a failure into a success by accident (whichalwayscould do simply by returning successfully!).
I hope that will help.