Skip to content

Commit

Permalink
fixup! make digest a public api on the Error value
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoff committed Sep 22, 2022
1 parent 4110b94 commit 6722894
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/react-client/src/__tests__/ReactFlight-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ describe('ReactFlight', () => {
expect(this.state.error.digest).toBe('a dev digest');
} else {
expect(this.state.error.message).toBe(
'An error occurred in the Server Components render.',
'An error occurred in the Server Components render. The specific message is omitted in production' +
' builds to avoid leaking sensitive details. A digest property is included on this error instance which' +
' may provide additional details about the nature of the error.',
);
expect(this.state.error.digest).toContain(this.props.expectedMessage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ describe('ReactFlightDOMBrowser', () => {
} else {
errorBoundaryFn = e => {
expect(e.message).toBe(
'An error occurred in the Server Components render.',
'An error occurred in the Server Components render. The specific message is omitted in production' +
' builds to avoid leaking sensitive details. A digest property is included on this error instance which' +
' may provide additional details about the nature of the error.',
);
return <p>{e.digest}</p>;
};
Expand Down Expand Up @@ -519,7 +521,9 @@ describe('ReactFlightDOMBrowser', () => {
} else {
errorBoundaryFn = e => {
expect(e.message).toBe(
'An error occurred in the Server Components render.',
'An error occurred in the Server Components render. The specific message is omitted in production' +
' builds to avoid leaking sensitive details. A digest property is included on this error instance which' +
' may provide additional details about the nature of the error.',
);
return <p>{e.digest}</p>;
};
Expand Down
2 changes: 1 addition & 1 deletion scripts/error-codes/codes.json
Original file line number Diff line number Diff line change
Expand Up @@ -426,5 +426,5 @@
"438": "An unsupported type was passed to use(): %s",
"439": "We didn't expect to see a forward reference. This is a bug in the React Server.",
"440": "An event from useEvent was called during render.",
"441": "An error occurred in the Server Components render."
"441": "An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error."
}

0 comments on commit 6722894

Please sign in to comment.