Replace when.otherwise() with Promise.catch()

Fixes #1584
This commit is contained in:
Nick O'Leary
2018-01-29 09:50:41 +00:00
parent 1d4a435f20
commit 519edce0ed
6 changed files with 12 additions and 12 deletions

View File

@@ -40,7 +40,7 @@ module.exports = {
redNodes.addFlow(flow).then(function(id) {
log.audit({event: "flow.add",id:id},req);
res.json({id:id});
}).otherwise(function(err) {
}).catch(function(err) {
log.audit({event: "flow.add",error:err.code||"unexpected_error",message:err.toString()},req);
res.status(400).json({error:err.code||"unexpected_error", message:err.toString()});
})
@@ -53,7 +53,7 @@ module.exports = {
redNodes.updateFlow(id,flow).then(function() {
log.audit({event: "flow.update",id:id},req);
res.json({id:id});
}).otherwise(function(err) {
}).catch(function(err) {
log.audit({event: "flow.update",error:err.code||"unexpected_error",message:err.toString()},req);
res.status(400).json({error:err.code||"unexpected_error", message:err.toString()});
})