1
我想弄明白這一點。我有這樣的承諾Javascript抓住然後承諾
function Function1() {
return fetch()
.then((xx) =>)
.catch(error => throw(error));
}
在另一個文件中使用此Function1承諾。
Function1()
.then((xx) =>()
.catch((error) => {
console.log('I want to Catch that stupid error here');
});
爲什麼我不能從捕獲錯誤中的Function1承諾中拋出錯誤消息,我在調用此Function1()?
您的任何種類的幫助和建議,我將不勝感激,親切:)
一開始'.catch(錯誤=>擲(錯誤));'是多餘的,並不需要它,擺脫它 - 無效語法反正 –
'。然後((xx)=>()' - 缺少一些東西? –
你有一個缺失的「)」Function1()。然後(xx =>())。catch((error)=> {console.log('我想趕上這個愚蠢的錯誤');}); –