成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

javascript - express 中 promise 處理異常

瀏覽:113日期:2023-09-23 17:09:28

問(wèn)題描述

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);

問(wèn)題解答

回答1:

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

等于

catch(next)function next(err){}

你說(shuō)可以么?

回答2:

setTimeout(function(){ doSomeSth()},1000)setTimeout(doSomeSth,1000);

標(biāo)簽: JavaScript
相關(guān)文章: