Change www error shim API (#13454)
Dan Abramov committed
Aug 21, 2018 at 18:38 UTC
5cb0f2bf518e28be6526eb16cccb9b818d3d26cf
1 file changed
+2
-13
packages/shared/forks/invokeGuardedCallbackImpl.www.js
+2
-13
@@ -14,12 +14,6 @@ invariant(
14
'Expected ReactFbErrorUtils.invokeGuardedCallback to be a function.',
15
);
16
17
-// This object will be mutated by the www version.
18
-let result = {
19
- _hasCaughtError: false,
20
- _caughtError: null,
21
-};
22
-
17
let invokeGuardedCallbackImpl = function<A, B, C, D, E, F, Context>(
18
name: string | null,
19
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>(
25
e: E,
26
f: F,
27
) {
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);
30
};
31
32
export default invokeGuardedCallbackImpl;