Skip to content

Commit fd5d063

Browse files
committed
Fix Prettier error and remove parameters to prevent log leak
1 parent e62268b commit fd5d063

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

packages/react-native/Libraries/ReactNative/UIManager.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,7 @@ const UIManager = {
185185
// case. We throw early here in Javascript so we can get a JS stacktrace
186186
// instead of a harder-to-debug native Java or Objective-C stacktrace.
187187
if (typeof reactTag !== 'number') {
188-
let stringifiedArgs = '(failed to stringify commandArgs)';
189-
try {
190-
stringifiedArgs = JSON.stringify(commandArgs);
191-
} catch (err) {
192-
// Do nothing. We have a default message
193-
}
194-
throw new Error(`dispatchViewManagerCommand: found null reactTag with args ${stringifiedArgs}`);
188+
throw new Error('dispatchViewManagerCommand: found null reactTag');
195189
}
196190

197191
if (isFabricReactTag(reactTag)) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,22 +364,21 @@ public void invoke(JSInstance jsInstance, ReadableArray parameters) {
364364
+ " at argument index "
365365
+ getAffectedRange(
366366
jsArgumentsConsumed, mArgumentExtractors[i].getJSArgumentsNeeded())
367-
+ ") with parameters "
368-
+ parameters.toArrayList(),
367+
+ ")",
369368
e);
370369
}
371370

372371
try {
373372
mMethod.invoke(mModuleWrapper.getModule(), mArguments);
374373
} catch (IllegalArgumentException | IllegalAccessException e) {
375-
throw new RuntimeException(createInvokeExceptionMessage(traceName, parameters), e);
374+
throw new RuntimeException(createInvokeExceptionMessage(traceName), e);
376375
} catch (InvocationTargetException ite) {
377376
// Exceptions thrown from native module calls end up wrapped in InvocationTargetException
378377
// which just make traces harder to read and bump out useful information
379378
if (ite.getCause() instanceof RuntimeException) {
380379
throw (RuntimeException) ite.getCause();
381380
}
382-
throw new RuntimeException(createInvokeExceptionMessage(traceName, parameters), ite);
381+
throw new RuntimeException(createInvokeExceptionMessage(traceName), ite);
383382
}
384383
} finally {
385384
SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE).flush();
@@ -388,10 +387,10 @@ public void invoke(JSInstance jsInstance, ReadableArray parameters) {
388387

389388
/**
390389
* Makes it easier to determine the cause of an error invoking a native method from Javascript
391-
* code by adding the function and parameters.
390+
* code by adding the function name.
392391
*/
393-
private static String createInvokeExceptionMessage(String traceName, ReadableArray parameters) {
394-
return "Could not invoke " + traceName + " with parameters " + parameters.toArrayList();
392+
private static String createInvokeExceptionMessage(String traceName) {
393+
return "Could not invoke " + traceName;
395394
}
396395

397396
/**

0 commit comments

Comments
 (0)