文章详情页
javascript - express 中 promise 处理异常
浏览:211日期: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
相关文章:
1. Ghost安装Win8出现1868问题的解决方案2. java - 安卓调用c++lib3. mysql连表排序4. Browser-sync安装失败问题5. java - 关于File的问题?6. 在cmd下进入mysql数据库,可以输入中文,但是查看表信息,不显示中文,是怎么回事,怎新手,请老师7. html5 - canvas中的mousedrag事件,为什么鼠标拖出canvas,然后再次移入canvas,drag事件还触发8. javascript - es6将类数组转化成数组的问题9. mysql - SELECT 多個資料表及多個欄位10. mysql - 我的myeclipse一直连显示数据库连接失败,不知道为什么
排行榜

网公网安备