Skip to content

Commit

Permalink
Stop catching IllegalArgumentException in ReactPackageTurboModuleMana…
Browse files Browse the repository at this point in the history
…gerDelegate

Summary:
Now that 0.74 has been cut, we can drop this warning and let the exception bubble up.

In facebook#41509 we stopped masking this.

Changelog: [Android][Changed] Throwing IllegalArgumentException from ReactPackage is no longer suppressed

Reviewed By: cortinico, cipolleschi

Differential Revision: D54068429
  • Loading branch information
javache authored and facebook-github-bot committed Feb 22, 2024
1 parent b857a6e commit a88d1f7
Showing 1 changed file with 16 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
package com.facebook.react;

import androidx.annotation.Nullable;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.jni.HybridData;
import com.facebook.react.bridge.CxxModuleWrapper;
import com.facebook.react.bridge.ModuleSpec;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.internal.turbomodule.core.TurboModuleManagerDelegate;
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
Expand Down Expand Up @@ -164,25 +162,15 @@ public TurboModule getModule(String moduleName) {
NativeModule resolvedModule = null;

for (final ModuleProvider moduleProvider : mModuleProviders) {
try {
final ReactModuleInfo moduleInfo = mPackageModuleInfos.get(moduleProvider).get(moduleName);
if (moduleInfo != null
&& moduleInfo.isTurboModule()
&& (resolvedModule == null || moduleInfo.canOverrideExistingModule())) {

final NativeModule module = moduleProvider.getModule(moduleName);
if (module != null) {
resolvedModule = module;
}
}
final ReactModuleInfo moduleInfo = mPackageModuleInfos.get(moduleProvider).get(moduleName);
if (moduleInfo != null
&& moduleInfo.isTurboModule()
&& (resolvedModule == null || moduleInfo.canOverrideExistingModule())) {

} catch (IllegalArgumentException ex) {
// TODO T170570617: remove this catch statement and let exception bubble up
FLog.e(
ReactConstants.TAG,
ex,
"Caught exception while constructing module '%s'. This was previously ignored but will not be caught in the future.",
moduleName);
final NativeModule module = moduleProvider.getModule(moduleName);
if (module != null) {
resolvedModule = module;
}
}
}

Expand Down Expand Up @@ -227,24 +215,15 @@ public NativeModule getLegacyModule(String moduleName) {
NativeModule resolvedModule = null;

for (final ModuleProvider moduleProvider : mModuleProviders) {
try {
final ReactModuleInfo moduleInfo = mPackageModuleInfos.get(moduleProvider).get(moduleName);
if (moduleInfo != null
&& !moduleInfo.isTurboModule()
&& (resolvedModule == null || moduleInfo.canOverrideExistingModule())) {

final NativeModule module = moduleProvider.getModule(moduleName);
if (module != null) {
resolvedModule = module;
}
final ReactModuleInfo moduleInfo = mPackageModuleInfos.get(moduleProvider).get(moduleName);
if (moduleInfo != null
&& !moduleInfo.isTurboModule()
&& (resolvedModule == null || moduleInfo.canOverrideExistingModule())) {

final NativeModule module = moduleProvider.getModule(moduleName);
if (module != null) {
resolvedModule = module;
}
} catch (IllegalArgumentException ex) {
// TODO T170570617: remove this catch statement and let exception bubble up
FLog.e(
ReactConstants.TAG,
ex,
"Caught exception while constructing module '%s'. This was previously ignored but will not be caught in the future.",
moduleName);
}
}

Expand Down

0 comments on commit a88d1f7

Please sign in to comment.