Skip to content

Commit

Permalink
Report error to error overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Sep 9, 2024
1 parent ee9614d commit be5f9a7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/next/src/server/dev/hot-reloader-turbopack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import {
isWellKnownError,
printNonFatalIssue,
normalizedPageToTurbopackStructureRoute,
TurbopackInternalError,
} from './turbopack-utils'
import {
propagateServerField,
Expand Down Expand Up @@ -452,6 +453,23 @@ export async function createHotReloaderTurbopack(
}
}
} catch (e) {
if (e instanceof TurbopackInternalError) {
sendToClient(client, {
action: HMR_ACTIONS_SENT_TO_BROWSER.SYNC,
errors: [
{
message:
'An unexpected Turbopack error occurred. Please see the output of `next dev` for more details.',
},
],
hash: String(++hmrHash),
warnings: [],
versionInfo: await versionInfoPromise,
})
client.close()
return
}

// The client might be using an HMR session from a previous server, tell them
// to fully reload the page to resolve the issue. We can't use
// `hotReloader.send` since that would force every connected client to
Expand Down

0 comments on commit be5f9a7

Please sign in to comment.