Skip to content

Commit

Permalink
add hostname to default error boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Jan 21, 2025
1 parent 029a819 commit af70ac9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
9 changes: 4 additions & 5 deletions packages/next/src/client/components/error-boundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,10 @@ export function GlobalError({ error }: { error: any }) {
<div style={styles.error}>
<div>
<h2 style={styles.text}>
{`Application error: a ${
digest ? 'server' : 'client'
}-side exception has occurred (see the ${
digest ? 'server logs' : 'browser console'
} for more information).`}
Application error: a {digest ? 'server' : 'client'}-side exception
has occurred while loading {window.location.hostname} (see the{' '}
{digest ? 'server logs' : 'browser console'} for more
information).
</h2>
{digest ? <p style={styles.text}>{`Digest: ${digest}`}</p> : null}
</div>
Expand Down
5 changes: 3 additions & 2 deletions packages/next/src/pages/_error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ export default class Error<P = {}> extends React.Component<P & ErrorProps> {
title
) : (
<>
Application error: a client-side exception has occurred (see
the browser console for more information)
Application error: a client-side exception has occurred while
loading {window.location.hostname} (see the browser console
for more information)
</>
)}
.
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/app-dir/errors/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe('app-dir - errors', () => {
expect(
await browser.waitForElementByCss('body').elementByCss('h2').text()
).toBe(
'Application error: a client-side exception has occurred (see the browser console for more information).'
'Application error: a client-side exception has occurred while loading localhost (see the browser console for more information).'
)
}
})
Expand All @@ -168,7 +168,7 @@ describe('app-dir - errors', () => {
expect(
await browser.waitForElementByCss('body').elementByCss('h2').text()
).toBe(
'Application error: a server-side exception has occurred (see the server logs for more information).'
'Application error: a server-side exception has occurred while loading localhost (see the server logs for more information).'
)
expect(
await browser.waitForElementByCss('body').elementByCss('p').text()
Expand Down

0 comments on commit af70ac9

Please sign in to comment.