Skip to content

Commit 5cb0f2b

Browse files
authored
Change www error shim API (#13454)
1 parent e106b8c commit 5cb0f2b

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

packages/shared/forks/invokeGuardedCallbackImpl.www.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ invariant(
1414
'Expected ReactFbErrorUtils.invokeGuardedCallback to be a function.',
1515
);
1616

17-
// This object will be mutated by the www version.
18-
let result = {
19-
_hasCaughtError: false,
20-
_caughtError: null,
21-
};
22-
2317
let invokeGuardedCallbackImpl = function<A, B, C, D, E, F, Context>(
2418
name: string | null,
2519
func: (a: A, b: B, c: C, d: D, e: E, f: F) => mixed,
@@ -31,13 +25,8 @@ let invokeGuardedCallbackImpl = function<A, B, C, D, E, F, Context>(
3125
e: E,
3226
f: F,
3327
) {
34-
// The www version doesn't take the `onError` callback on context.
35-
// Instead, it writes the result to fields on context.
36-
// TODO: change the www function API so we can re-export it directly.
37-
ReactFbErrorUtils.invokeGuardedCallback.apply(result, arguments);
38-
if (result._hasCaughtError) {
39-
this.onError(result._caughtError);
40-
}
28+
// This will call `this.onError(err)` if an error was caught.
29+
ReactFbErrorUtils.invokeGuardedCallback.apply(this, arguments);
4130
};
4231

4332
export default invokeGuardedCallbackImpl;

0 commit comments

Comments
 (0)