如果希望兩個.catch都執行,則需要在第一個內拋出,否則結果將是getCustomer將始終返回一個解析的承諾。您還需要對Promise構造函數使用reject參數。 new Promise((resolve, reject) => { // ... .catch(err => { console.log('error happened', err); reject(err); }) 并確保以React代碼返回承諾調用: return setCustomer(res); 雖然這是可能的,但如果可行,通常更好的方法是不捕獲下面的錯誤,而是讓調用方處理它。也不要使用顯式承諾構造反模式。 const getCustomer= (body) => { return fetch('/getCustomer', { method: 'post', body: JSON.stringify(body), headers: { Accept: "application/json" Content-type: "application/json"- }, }) .then(response => response.json()); }; 這是我想要的。除非您真的需要setCustomer本身來處理它,否則就讓錯誤滲透到它的調用者。