I don\'t necessarily want to error, but I have:
getFromDb().then (tradeData) ->
if not tradeData
# DO NOT CONTINUE THE CHAIN
else
getLatestPri
Although an accepted answer, but I would like to tell all of googlers that, "break()" function has been changed to "cancel()"
Use Something like this:
p = getFromDb().then (tradeData) ->
if not tradeData
send("no data");
p.cancel(); // Look Here!!!!!!!!!!!!!!!!
else
getLatestPrice tradeData
.then (latestPrice) ->
...
.then ->
...
.then ->
...
.catch (err) ->
next err
Before that, make sure to add following lines in config:
Promise.config({
cancellation: true
});