我正在运行此代码并在没有互联网连接的情况下进行测试:
fetch(url, options)
.then(res => {
// irrelevant, as catch happens immediately on no network connection
})
.catch(err => {
console.log('Failed fetch ', err);
});
“类型错误”是什么意思?
最佳答案
从你的代码片段中,它应该记录
Failed fetch TypeError: ...
获取失败时抛出和TypeError
更多信息请查看
关于javascript - 为什么 fetch 会返回 "TypeError: Failed to fetch"而不仅仅是 "Failed to fetch"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59317819/