文章詳情頁
javascript - express 中 promise 處理異常
瀏覽:114日期: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
相關文章:
排行榜
