Unverified Commit fa01a159 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update client error to show link in console (#27789)

* Update client error to show link in console

* Apply suggestions from code review
parent d3138559
...@@ -457,6 +457,10 @@ export function renderError(renderErrorProps: RenderErrorProps): Promise<any> { ...@@ -457,6 +457,10 @@ export function renderError(renderErrorProps: RenderErrorProps): Promise<any> {
// Make sure we log the error to the console, otherwise users can't track down issues. // Make sure we log the error to the console, otherwise users can't track down issues.
console.error(err) console.error(err)
console.error(
`A client-side exception has occurred, see here for more info: https://nextjs.org/docs/messages/client-side-exception-occurred`
)
return pageLoader return pageLoader
.loadPage('/_error') .loadPage('/_error')
.then(({ page: ErrorComponent, styleSheets }) => { .then(({ page: ErrorComponent, styleSheets }) => {
......
...@@ -57,11 +57,8 @@ export default class Error<P = {}> extends React.Component<P & ErrorProps> { ...@@ -57,11 +57,8 @@ export default class Error<P = {}> extends React.Component<P & ErrorProps> {
title title
) : ( ) : (
<> <>
Application error: a client-side exception has occurred ( Application error: a client-side exception has occurred (see
<a href="https://nextjs.org/docs/messages/client-side-exception-occurred"> the browser console for more information)
developer guidance
</a>
)
</> </>
)} )}
. .
......
...@@ -1509,7 +1509,7 @@ describe('CSS Support', () => { ...@@ -1509,7 +1509,7 @@ describe('CSS Support', () => {
await browser.waitForElementByCss('#link-other').click() await browser.waitForElementByCss('#link-other').click()
await check( await check(
() => browser.eval(`document.body.innerText`), () => browser.eval(`document.body.innerText`),
'Application error: a client-side exception has occurred (developer guidance).', 'Application error: a client-side exception has occurred (see the browser console for more information).',
true true
) )
......
...@@ -39,7 +39,7 @@ const runTests = () => { ...@@ -39,7 +39,7 @@ const runTests = () => {
it('should load 404 page correctly', async () => { it('should load 404 page correctly', async () => {
const browser = await webdriver(appPort, '/non-existent') const browser = await webdriver(appPort, '/non-existent')
expect(await browser.elementByCss('h2').text()).toBe( expect(await browser.elementByCss('h2').text()).toBe(
'Application error: a client-side exception has occurred (developer guidance).' 'Application error: a client-side exception has occurred (see the browser console for more information).'
) )
expect(await browser.eval('window.uncaughtErrors')).toEqual([]) expect(await browser.eval('window.uncaughtErrors')).toEqual([])
}) })
...@@ -74,7 +74,7 @@ const runTests = () => { ...@@ -74,7 +74,7 @@ const runTests = () => {
await browser.waitForElementByCss('h2') await browser.waitForElementByCss('h2')
expect(await browser.eval('window.beforeNav')).toBe(null) expect(await browser.eval('window.beforeNav')).toBe(null)
expect(await browser.elementByCss('h2').text()).toBe( expect(await browser.elementByCss('h2').text()).toBe(
'Application error: a client-side exception has occurred (developer guidance).' 'Application error: a client-side exception has occurred (see the browser console for more information).'
) )
expect(await browser.eval('window.uncaughtErrors')).toEqual([]) expect(await browser.eval('window.uncaughtErrors')).toEqual([])
}) })
......
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