Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always rethrow original error when we replay errors #20425

Merged
merged 1 commit into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions fixtures/dom/src/components/fixtures/error-handling/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,20 @@ class TrySilenceFatalError extends React.Component {
}
}

function naiveMemoize(fn) {
let memoizedEntry;
return function() {
if (!memoizedEntry) {
memoizedEntry = {result: null};
memoizedEntry.result = fn();
}
return memoizedEntry.result;
};
}
let memoizedFunction = naiveMemoize(function() {
throw new Error('Passed');
});

export default class ErrorHandlingTestCases extends React.Component {
render() {
return (
Expand Down Expand Up @@ -288,6 +302,21 @@ export default class ErrorHandlingTestCases extends React.Component {
}}
/>
</TestCase>
<TestCase title="Throwing memoized result" description="">
<TestCase.Steps>
<li>Click the "Trigger error" button</li>
<li>Click the reset button</li>
</TestCase.Steps>
<TestCase.ExpectedResult>
The "Trigger error" button should be replaced with "Captured an
error: Passed". Clicking reset should reset the test case.
</TestCase.ExpectedResult>
<Example
doThrow={() => {
memoizedFunction().value;
}}
/>
</TestCase>
<TestCase
title="Cross-origin errors (development mode only)"
description="">
Expand Down
Loading