文章详情页
javascript - express 中 promise 处理异常
浏览:58日期:2023-09-23 17:09:28
问题描述
sms_code(userInfo).then(function(data){ return res.json(data);}).then(function(data){ return res.json(data);}).catch(next);
为什么
catch(function(err){ next(err)})
可以缩写成
.catch(next);
问题解答
回答1:catch(function(err){ next(err)})
等于
catch(next)function next(err){}
你说可以么?
回答2:setTimeout(function(){ doSomeSth()},1000)setTimeout(doSomeSth,1000);
标签:
JavaScript
相关文章:
排行榜
