Unverified Commit d45df25d authored by Flo's avatar Flo Committed by GitHub

Fix:Manage Firefox and Safari Network error message (#44929)

Not all browsers implement the network error message in the same way:
For example if I execute `fetch('//foo.bar/').catch(err =>
console.log(err.message))` in Chrome / Firefox / Safari browsers
console, I get respectively:
- `Failed to fetch`
- `NetworkError when attempting to fetch resource.`
- `Load failed`

This PR fixes it.

## Bug

- [x] Related issues linked using fixes
[#45190](https://github.com/vercel/next.js/issues/45190)
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent 57ba24e3
......@@ -791,7 +791,14 @@ function fetchNextData({
if (!unstable_skipClientCache) {
delete inflightCache[cacheKey]
}
if (err.message === 'Failed to fetch') {
if (
// chrome
err.message === 'Failed to fetch' ||
// firefox
err.message === 'NetworkError when attempting to fetch resource.' ||
// safari
err.message === 'Load failed'
) {
markAssetError(err)
}
throw err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment