发送 this.$inertia.patch 请求时,我无法捕获网络错误。我正在关闭后端服务器以模拟丢失的连接。控制台显示: Uncaught (in Promise) Error: Network Error.
我尝试过 Inertia 的 onError,尝试在请求后添加 .catch 以及单独的 try...catch 并使用 Vue 2
errorCaptured: function(err) {
console.log('Caught error', err.message)
},
如果需要,我可以提供更多详细信息。
所以基本上试图捕获 net::ERR_CONNECTION_REFUSED
编辑:我开始使用 onFinish 以及 onSuccess 和 onStart,但最终使用了 axios
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
将
onStart与onSuccess和onFinish一起使用:onFinish将触发而onSuccess。onError将触发 withonFinish