控制臺報錯信息
不需要處理錯誤邏輯時儒喊,也不影響代碼執(zhí)行祠肥,但是控制臺報一大片紅也很難受纸镊。
出現(xiàn)場景:
const response=await this.util.getData(apiConfig.commomCode,{});
處理方法:我們需要進(jìn)行錯誤捕獲鸵闪,即catch捕獲
try{
const response=await this.util.postData(apiConfig.creat,req)
}catch(e){
console.log(e.message);
}