Skip to content

Commit

Permalink
still log if error is not network error
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Feb 15, 2024
1 parent 20f78aa commit e1a5857
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
19 changes: 12 additions & 7 deletions packages/next/src/server/dev/hot-reloader-webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ function erroredPages(compilation: webpack.Compilation) {
return failedPages
}

const networkErrors = [
'EADDRINFO',
'ENOTFOUND',
'ETIMEDOUT',
'ECONNREFUSED',
'EAI_AGAIN',
]

export async function getVersionInfo(enabled: boolean): Promise<VersionInfo> {
let installed = '0.0.0'

Expand All @@ -206,14 +214,11 @@ export async function getVersionInfo(enabled: boolean): Promise<VersionInfo> {

if (!res.ok) return { installed, staleness: 'unknown' }

const tags = await res.json()
const { latest, canary } = await res.json()

return parseVersionInfo({
installed,
latest: tags.latest,
canary: tags.canary,
})
} catch {
return parseVersionInfo({ installed, latest, canary })
} catch (e: any) {
if (!networkErrors.includes(e?.code)) console.error(e)
return { installed, staleness: 'unknown' }
}
}
Expand Down
4 changes: 0 additions & 4 deletions test/development/acceptance-app/version-staleness.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import { outdent } from 'outdent'
describe('Error Overlay version staleness', () => {
const { next } = nextTestSetup({
files: new FileRef(path.join(__dirname, 'fixtures', 'default-template')),
dependencies: {
react: 'latest',
'react-dom': 'latest',
},
skipStart: true,
})

Expand Down

0 comments on commit e1a5857

Please sign in to comment.