Uncaught (in promise) AxiosError
时间: 2023-10-18 12:25:48 浏览: 125
"Uncaught (in promise) AxiosError"错误通常是由于使用Promise时出现了异常而未进行适当处理导致的。根据引用中的解决方法,你可以在使用axios请求接口时,在then()后加上catch(),这样可以捕获并处理异常。另外,在请求回来时,你也可以使用.catch()方法来捕获异常并进行处理。例如,你可以使用return Promise.reject(new Error(res.msg || 'Error'))来返回接口返回的错误信息,并在请求回来时使用.catch(err=>{console.log(err)})来捕获异常。这样可以避免出现"Uncaught (in promise) AxiosError"错误。 <span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Uncaught (in promise) Error](https://blog.csdn.net/wh13821662259/article/details/117986956)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [解决axios发送post请求返回400状态码的问题](https://download.csdn.net/download/weixin_38609765/14813353)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文