Skip to content

Commit 2aee426

Browse files
rubennortemeta-codesync[bot]
authored andcommitted
Remove unnecessary catch bindings (#53939)
Summary: Pull Request resolved: #53939 Changelog: [internal] This is a codemod to remove all unnecessary catch bindings from the `react-native` package. Reviewed By: cortinico Differential Revision: D83245581 fbshipit-source-id: 90c27b88e924e8a9dae6b1b5228689cc528219c9
1 parent 0be68b3 commit 2aee426

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

packages/react-native/Libraries/Core/setUpReactDevTools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if (__DEV__) {
4949
try {
5050
const parsedSettings = JSON.parse(serializedHookSettings);
5151
hookSettings = parsedSettings;
52-
} catch (e: unknown) {
52+
} catch {
5353
console.error(
5454
'Failed to parse persisted React DevTools hook settings. React DevTools will be initialized with default settings.',
5555
);

packages/react-native/Libraries/Network/XMLHttpRequest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class XMLHttpRequest extends EventTarget {
284284
case 'json':
285285
try {
286286
this._cachedResponse = JSON.parse(this._response);
287-
} catch (_: unknown) {
287+
} catch {
288288
this._cachedResponse = null;
289289
}
290290
break;

packages/react-native/Libraries/Utilities/HMRClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ const HMRClient: HMRClientNativeInterface = {
141141
),
142142
}),
143143
);
144-
} catch (error) {
144+
} catch {
145145
// If sending logs causes any failures we want to silently ignore them
146146
// to ensure we do not cause infinite-logging loops.
147147
}

packages/react-native/Libraries/Utilities/stringifySafe.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function createStringifySafeWithLimits(limits: {
8484
} else if (typeof arg === 'function') {
8585
try {
8686
return arg.toString();
87-
} catch (e) {
87+
} catch {
8888
return '[function unknown]';
8989
}
9090
} else if (arg instanceof Error) {
@@ -98,12 +98,12 @@ export function createStringifySafeWithLimits(limits: {
9898
return '["' + typeof arg + '" failed to stringify]';
9999
}
100100
return ret;
101-
} catch (e) {
101+
} catch {
102102
if (typeof arg.toString === 'function') {
103103
try {
104104
// $FlowFixMe[incompatible-use] : toString shouldn't take any arguments in general.
105105
return arg.toString();
106-
} catch (E) {}
106+
} catch {}
107107
}
108108
}
109109
}

packages/react-native/src/private/webapis/dom/events/EventHandlerAttributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function setEventHandlerAttribute(
119119
setEventHandlerAttributeMap(target, map);
120120
}
121121
map.set(type, listener);
122-
} catch (e) {
122+
} catch {
123123
// Assigning incorrect listener does not throw in setters.
124124
}
125125
}

packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventCaptureMouse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function PointerEventCaptureMouseTestCase(
4646
try {
4747
// $FlowFixMe[prop-missing]
4848
target0.setPointerCapture(evt.nativeEvent.pointerId);
49-
} catch (e) {}
49+
} catch {}
5050
}
5151
}, []);
5252

0 commit comments

Comments
 (0)