Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create hash digest for errors in app in production (#41559)
- Loading branch information
1 parent
fda355d
commit 4ba1002
Showing
5 changed files
with
73 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
test/e2e/app-dir/app/app/error/server-component/custom-digest/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const config = { | ||
revalidate: 0, | ||
} | ||
|
||
export default function Page() { | ||
const err = new Error('this is a test') | ||
err.digest = 'custom' | ||
throw err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use client' | ||
|
||
export default function ErrorBoundary({ error, reset }) { | ||
return ( | ||
<> | ||
<p id="error-boundary-message">{error.message}</p> | ||
<p id="error-boundary-digest">{error.digest}</p> | ||
<button id="reset" onClick={() => reset()}> | ||
Try again | ||
</button> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const config = { | ||
revalidate: 0, | ||
} | ||
|
||
export default function Page() { | ||
throw new Error('this is a test') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters