javascript - promise handling exception in express
怪我咯
怪我咯 2017-05-16 13:25:13
0
2
415
sms_code(userInfo).then(function(data){
    return res.json(data);
})
.then(function(data){
    return res.json(data);
})
.catch(next);

Why

catch(function(err){
    next(err)
})

can be abbreviated to

.catch(next);
怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
phpcn_u1582
catch(function(err){
    next(err)
})

equals

catch(next)

function next(err){

}

Do you think it’s okay?

阿神
setTimeout(function(){
    doSomeSth()
},1000)

setTimeout(doSomeSth,1000);

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template