[英]What is the correct way of catching an error?
如何為錯誤消息設置變量? 這是我的代碼:
.catch(console.error).then((err) => {
var x = err.message;
)};
我收到此錯誤:
無法讀取未定義的屬性“消息”
您在catch
調用中得到錯誤:
.catch((err) => {
console.error(err);
var x = err.message;
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.