文章詳情頁
javascript - express 中 promise 處理異常
瀏覽:103日期: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. 求救一下,用新版的phpstudy,數據庫過段時間會消失是什么情況?2. php - mysql 模糊搜索問題3. javascript - 在 vue里面用import引入js文件,結果為undefined4. php工具箱配置第二個vhost主機時不生效,報錯You don’t have permission5. php - 微信開發驗證服務器有效性6. javascript - 求幫助 , ATOM不顯示界面!!!!7. javascript - js setTimeout在雙重for循環中如何使用?8. html - 爬蟲時出現“DNS lookup failed”,打開網頁卻沒問題,這是什么情況?9. [python2]local variable referenced before assignment問題10. javascript - 我的站點貌似被別人克隆了, google 搜索特定文章,除了域名不一樣,其他的都一樣,如何解決?
排行榜
