fn1().then(function(res){
console.log(res)
return fn2(res).then(function(res){
console.log(res)
},function(err){
console.log(err)
})
}).catch(function(res){
return fn3(res).then(function(res){
console.log(res)
},function(err){
console.log(err)
})
})
fn1 executes and takes different routes according to the returned result. If return fn2, fails, return fn3, seems to start to nest again. Is there a better way to write it?