mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Rename ReactSoftException to ReactSoftExceptionLogger
Summary: ReactSoftException makes it seem like the class is an Exception, when it's actually a logger. This rename I think is more appropriate. Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D30251735 fbshipit-source-id: 550bd543388e698774ec31753200bd3f722d8c17
This commit is contained in:
committed by
Facebook GitHub Bot
parent
56dcc6ea55
commit
cbec66ef92
@@ -68,7 +68,7 @@ import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
@@ -524,7 +524,7 @@ public class ReactInstanceManager {
|
||||
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||
.emit("toggleElementInspector", null);
|
||||
} else {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Cannot toggleElementInspector, CatalystInstance not available"));
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
@@ -341,7 +341,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!child.isShown()) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"A view was illegally added as a child of a ReactRootView. "
|
||||
@@ -529,7 +529,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
||||
removeAllViews();
|
||||
|
||||
if (surfaceId == NO_ID) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new RuntimeException(
|
||||
"unmountReactApplication called on ReactRootView with invalid id"));
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.Callback;
|
||||
import com.facebook.react.bridge.LifecycleEventListener;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
import com.facebook.react.bridge.UIManagerListener;
|
||||
@@ -365,7 +365,7 @@ public class NativeAnimatedModule extends NativeAnimatedModuleSpec
|
||||
if (nodesManager != null) {
|
||||
nodesManager.initializeEventListenerForUIManagerType(mUIManagerType);
|
||||
} else {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
NAME,
|
||||
new RuntimeException(
|
||||
"initializeLifecycleEventListenersForViewTag could not get NativeAnimatedNodesManager"));
|
||||
|
||||
+4
-4
@@ -17,7 +17,7 @@ import com.facebook.react.bridge.JSApplicationCausedNativeException;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
@@ -391,7 +391,7 @@ import java.util.Queue;
|
||||
UIManager uiManager =
|
||||
UIManagerHelper.getUIManagerForReactTag(mReactApplicationContext, viewTag);
|
||||
if (uiManager == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"connectAnimatedNodeToView: Animated node could not be connected to UIManager - uiManager disappeared for tag: "
|
||||
@@ -753,11 +753,11 @@ import java.util.Queue;
|
||||
if (mEventListenerInitializedForFabric && cyclesDetected == 0) {
|
||||
// TODO T71377544: investigate these SoftExceptions and see if we can remove entirely
|
||||
// or fix the root cause
|
||||
ReactSoftException.logSoftException(TAG, new ReactNoCrashSoftException(ex));
|
||||
ReactSoftExceptionLogger.logSoftException(TAG, new ReactNoCrashSoftException(ex));
|
||||
} else if (mEventListenerInitializedForFabric) {
|
||||
// TODO T71377544: investigate these SoftExceptions and see if we can remove entirely
|
||||
// or fix the root cause
|
||||
ReactSoftException.logSoftException(TAG, new ReactNoCrashSoftException(ex));
|
||||
ReactSoftExceptionLogger.logSoftException(TAG, new ReactNoCrashSoftException(ex));
|
||||
} else {
|
||||
throw ex;
|
||||
}
|
||||
|
||||
@@ -30,13 +30,14 @@ public class BackgroundExecutor {
|
||||
// but it's also cheap to leave it here.
|
||||
|
||||
if (runnable == null) {
|
||||
ReactSoftException.logSoftException(TAG, new ReactNoCrashSoftException("runnable is null"));
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new ReactNoCrashSoftException("runnable is null"));
|
||||
return;
|
||||
}
|
||||
|
||||
final ExecutorService executorService = mExecutorService;
|
||||
if (executorService == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new ReactNoCrashSoftException("executorService is null"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ReactContext extends ContextWrapper {
|
||||
throw new IllegalStateException("ReactContext has been already initialized");
|
||||
}
|
||||
if (mDestroyed) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException("Cannot initialize ReactContext after it has been destroyed."));
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public abstract class ReactContextBaseJavaModule extends BaseJavaModule {
|
||||
if (ReactBuildConfig.DEBUG) {
|
||||
FLog.w(tag, msg);
|
||||
} else {
|
||||
ReactSoftException.logSoftException(tag, new RuntimeException(msg));
|
||||
ReactSoftExceptionLogger.logSoftException(tag, new RuntimeException(msg));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@DoNotStrip
|
||||
public class ReactSoftException {
|
||||
public class ReactSoftExceptionLogger {
|
||||
public interface ReactSoftExceptionListener {
|
||||
void logSoftException(final String category, final Throwable cause);
|
||||
}
|
||||
@@ -20,31 +20,32 @@ public class SoftAssertions {
|
||||
/**
|
||||
* Throw {@link AssertionException} with a given message. Use this method surrounded with {@code
|
||||
* if} block with assert condition in case you plan to do string concatenation to produce the
|
||||
* message. This logs an assertion with ReactSoftException, which decides whether or not to
|
||||
* message. This logs an assertion with ReactSoftExceptionLogger, which decides whether or not to
|
||||
* actually throw.
|
||||
*/
|
||||
public static void assertUnreachable(String message) {
|
||||
ReactSoftException.logSoftException("SoftAssertions", new AssertionException(message));
|
||||
ReactSoftExceptionLogger.logSoftException("SoftAssertions", new AssertionException(message));
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts the given condition, throwing an {@link AssertionException} if the condition doesn't
|
||||
* hold. This logs an assertion with ReactSoftException, which decides whether or not to actually
|
||||
* throw.
|
||||
* hold. This logs an assertion with ReactSoftExceptionLogger, which decides whether or not to
|
||||
* actually throw.
|
||||
*/
|
||||
public static void assertCondition(boolean condition, String message) {
|
||||
if (!condition) {
|
||||
ReactSoftException.logSoftException("SoftAssertions", new AssertionException(message));
|
||||
ReactSoftExceptionLogger.logSoftException("SoftAssertions", new AssertionException(message));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that the given Object isn't null, throwing an {@link AssertionException} if it was.
|
||||
* This logs an assertion with ReactSoftException, which decides whether or not to actually throw.
|
||||
* This logs an assertion with ReactSoftExceptionLogger, which decides whether or not to actually
|
||||
* throw.
|
||||
*/
|
||||
public static <T> T assertNotNull(@Nullable T instance) {
|
||||
if (instance == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
"SoftAssertions", new AssertionException("Expected object to not be null!"));
|
||||
}
|
||||
return instance;
|
||||
|
||||
@@ -43,7 +43,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
@@ -201,7 +201,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
@Deprecated
|
||||
public <T extends View> int addRootView(
|
||||
final T rootView, final WritableMap initialProps, final @Nullable String initialUITemplate) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalViewOperationException(
|
||||
"Do not call addRootView in Fabric; it is unsupported. Call startSurface instead."));
|
||||
@@ -336,7 +336,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
|
||||
public void stopSurface(final SurfaceHandler surfaceHandler) {
|
||||
if (!surfaceHandler.isRunning()) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
FabricUIManager.TAG,
|
||||
new IllegalStateException("Trying to stop surface that hasn't started yet"));
|
||||
return;
|
||||
@@ -384,7 +384,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
FLog.i(TAG, "FabricUIManager.onCatalystInstanceDestroy");
|
||||
|
||||
if (mDestroyed) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
FabricUIManager.TAG, new IllegalStateException("Cannot double-destroy FabricUIManager"));
|
||||
return;
|
||||
}
|
||||
@@ -790,7 +790,7 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
|
||||
// TODO T83615646: make this a hard-crash in the future.
|
||||
if (surfaceMountingManager == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalViewOperationException(
|
||||
"Cannot updateRootLayoutSpecs on surfaceId that does not exist: " + surfaceId));
|
||||
|
||||
+5
-5
@@ -21,7 +21,7 @@ import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.ThreadConfined;
|
||||
import com.facebook.react.bridge.ReactIgnorableMountingException;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.RetryableMountingLayerException;
|
||||
import com.facebook.react.fabric.mounting.mountitems.DispatchCommandMountItem;
|
||||
import com.facebook.react.fabric.mounting.mountitems.MountItem;
|
||||
@@ -131,7 +131,7 @@ public class MountItemDispatcher {
|
||||
if (mReDispatchCounter < 10 && didDispatchItems) {
|
||||
// Executing twice in a row is normal. Only log after that point.
|
||||
if (mReDispatchCounter > 2) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Re-dispatched "
|
||||
@@ -224,14 +224,14 @@ public class MountItemDispatcher {
|
||||
// exception but never crash in debug.
|
||||
// It's not clear that logging this is even useful, because these events are very
|
||||
// common, mundane, and there's not much we can do about them currently.
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Caught exception executing ViewCommand: " + command.toString(), e));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// Non-Retryable exceptions are logged as soft exceptions in prod, but crash in Debug.
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new RuntimeException(
|
||||
"Caught exception executing ViewCommand: " + command.toString(), e));
|
||||
@@ -280,7 +280,7 @@ public class MountItemDispatcher {
|
||||
}
|
||||
|
||||
if (ReactIgnorableMountingException.isIgnorable(e)) {
|
||||
ReactSoftException.logSoftException(TAG, e);
|
||||
ReactSoftExceptionLogger.logSoftException(TAG, e);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import androidx.annotation.UiThread;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.ThreadConfined;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.RetryableMountingLayerException;
|
||||
@@ -104,7 +104,7 @@ public class MountingManager {
|
||||
// This *will* crash in Debug mode, but not in production.
|
||||
mSurfaceIdToManager.putIfAbsent(surfaceId, surfaceMountingManager);
|
||||
if (mSurfaceIdToManager.get(surfaceId) != surfaceMountingManager) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException(
|
||||
"Called startSurface more than once for the SurfaceId [" + surfaceId + "]"));
|
||||
@@ -121,7 +121,7 @@ public class MountingManager {
|
||||
getSurfaceManagerEnforced(surfaceId, "attachView");
|
||||
|
||||
if (surfaceMountingManager.isStopped()) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new IllegalStateException("Trying to attach a view to a stopped surface"));
|
||||
return;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class MountingManager {
|
||||
mMostRecentSurfaceMountingManager = null;
|
||||
}
|
||||
} else {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException(
|
||||
"Cannot call stopSurface on non-existent surface: [" + surfaceId + "]"));
|
||||
|
||||
+8
-8
@@ -20,7 +20,7 @@ import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.infer.annotation.ThreadConfined;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.RetryableMountingLayerException;
|
||||
@@ -174,7 +174,7 @@ public class SurfaceMountingManager {
|
||||
}
|
||||
|
||||
if (rootView.getId() == mSurfaceId) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalViewOperationException(
|
||||
"Race condition in addRootView detected. Trying to set an id of ["
|
||||
@@ -322,7 +322,7 @@ public class SurfaceMountingManager {
|
||||
if (viewParent != null) {
|
||||
int actualParentId =
|
||||
viewParent instanceof ViewGroup ? ((ViewGroup) viewParent).getId() : View.NO_ID;
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException(
|
||||
"addViewAt: cannot insert view ["
|
||||
@@ -380,7 +380,7 @@ public class SurfaceMountingManager {
|
||||
|
||||
// TODO: throw exception here?
|
||||
if (parentViewState == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
MountingManager.TAG,
|
||||
new IllegalStateException(
|
||||
"Unable to find viewState for tag: [" + parentTag + "] for removeViewAt"));
|
||||
@@ -457,7 +457,7 @@ public class SurfaceMountingManager {
|
||||
// If we can fix the bug there, or remove the need for LayoutAnimation index adjustment
|
||||
// entirely, we can just throw this exception without regression user experience.
|
||||
logViewHierarchy(parentView, true);
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException(
|
||||
"Tried to remove view ["
|
||||
@@ -547,7 +547,7 @@ public class SurfaceMountingManager {
|
||||
// This represents a perf issue only, not a correctness issue. In the future we need to
|
||||
// refactor View preallocation to correct the currently incorrect assumptions.
|
||||
if (getNullableViewState(reactTag) != null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Cannot CREATE view with tag [" + reactTag + "], already exists."));
|
||||
@@ -879,7 +879,7 @@ public class SurfaceMountingManager {
|
||||
ViewState viewState = getNullableViewState(reactTag);
|
||||
|
||||
if (viewState == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
MountingManager.TAG,
|
||||
new IllegalStateException(
|
||||
"Unable to find viewState for tag: " + reactTag + " for deleteView"));
|
||||
@@ -910,7 +910,7 @@ public class SurfaceMountingManager {
|
||||
// We treat this as a perf problem and not a logical error. View Preallocation or unexpected
|
||||
// changes to Differ or C++ Binding could cause some redundant Create instructions.
|
||||
if (getNullableViewState(reactTag) != null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException(
|
||||
"Cannot Preallocate view with tag [" + reactTag + "], already exists."));
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
package com.facebook.react.fabric.mounting.mountitems;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.RetryableMountingLayerException;
|
||||
import com.facebook.react.fabric.mounting.MountingManager;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class SendAccessibilityEvent implements MountItem {
|
||||
// due to race conditions (like the view disappearing after the event is
|
||||
// queued and before it executes), we log a soft exception and continue along.
|
||||
// Other categories of errors will still cause a hard crash.
|
||||
ReactSoftException.logSoftException(TAG, e);
|
||||
ReactSoftExceptionLogger.logSoftException(TAG, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import android.os.Handler;
|
||||
import android.util.SparseArray;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.LifecycleState;
|
||||
import com.facebook.react.modules.appregistry.AppRegistry;
|
||||
@@ -112,7 +112,7 @@ public class HeadlessJsTaskContext {
|
||||
.getJSModule(AppRegistry.class)
|
||||
.startHeadlessTask(taskId, taskConfig.getTaskKey(), taskConfig.getData());
|
||||
} else {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
"HeadlessJsTaskContext",
|
||||
new RuntimeException("Cannot start headless task, CatalystInstance not available"));
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import com.facebook.fbreact.specs.NativeDeviceInfoSpec;
|
||||
import com.facebook.react.bridge.LifecycleEventListener;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.WritableNativeMap;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
@@ -96,7 +96,7 @@ public class DeviceInfoModule extends NativeDeviceInfoSpec implements LifecycleE
|
||||
.emit("didUpdateDimensions", displayMetrics);
|
||||
}
|
||||
} else {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
NAME,
|
||||
new ReactNoCrashSoftException(
|
||||
"No active CatalystInstance, cannot emitUpdateDimensionsEvent"));
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.Dynamic;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
||||
@@ -319,7 +319,7 @@ public class ReactAccessibilityDelegate extends AccessibilityDelegateCompat {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new ReactNoCrashSoftException("Cannot get RCTEventEmitter, no CatalystInstance"));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.facebook.react.bridge.CatalystInstance;
|
||||
import com.facebook.react.bridge.JSIModuleType;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.UIManager;
|
||||
import com.facebook.react.uimanager.common.UIManagerType;
|
||||
import com.facebook.react.uimanager.events.EventDispatcher;
|
||||
@@ -55,7 +55,7 @@ public class UIManagerHelper {
|
||||
if (context.isBridgeless()) {
|
||||
@Nullable UIManager uiManager = (UIManager) context.getJSIModule(JSIModuleType.UIManager);
|
||||
if (uiManager == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Cannot get UIManager because the instance hasn't been initialized yet."));
|
||||
@@ -65,7 +65,7 @@ public class UIManagerHelper {
|
||||
}
|
||||
|
||||
if (!context.hasCatalystInstance()) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Cannot get UIManager because the context doesn't contain a CatalystInstance."));
|
||||
@@ -74,7 +74,7 @@ public class UIManagerHelper {
|
||||
// TODO T60461551: add tests to verify emission of events when the ReactContext is being turn
|
||||
// down.
|
||||
if (!context.hasActiveReactInstance()) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Cannot get UIManager because the context doesn't contain an active CatalystInstance."));
|
||||
@@ -89,7 +89,7 @@ public class UIManagerHelper {
|
||||
: catalystInstance.getNativeModule(UIManagerModule.class);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// TODO T67518514 Clean this up once we migrate everything over to bridgeless mode
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Cannot get UIManager for UIManagerType: " + uiManagerType));
|
||||
@@ -105,7 +105,7 @@ public class UIManagerHelper {
|
||||
public static EventDispatcher getEventDispatcherForReactTag(ReactContext context, int reactTag) {
|
||||
EventDispatcher eventDispatcher = getEventDispatcher(context, getUIManagerType(reactTag));
|
||||
if (eventDispatcher == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new IllegalStateException("Cannot get EventDispatcher for reactTag " + reactTag));
|
||||
}
|
||||
return eventDispatcher;
|
||||
@@ -127,7 +127,7 @@ public class UIManagerHelper {
|
||||
}
|
||||
UIManager uiManager = getUIManager(context, uiManagerType, false);
|
||||
if (uiManager == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Unable to find UIManager for UIManagerType " + uiManagerType));
|
||||
@@ -135,7 +135,7 @@ public class UIManagerHelper {
|
||||
}
|
||||
EventDispatcher eventDispatcher = (EventDispatcher) uiManager.getEventDispatcher();
|
||||
if (eventDispatcher == null) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException(
|
||||
"Cannot get EventDispatcher for UIManagerType " + uiManagerType));
|
||||
@@ -180,7 +180,7 @@ public class UIManagerHelper {
|
||||
|
||||
// All Fabric-managed Views (should) have a ThemedReactContext attached.
|
||||
if (surfaceId == -1) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException(
|
||||
"Fabric View [" + reactTag + "] does not have SurfaceId associated with it"));
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.facebook.react.bridge.GuardedRunnable;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.RetryableMountingLayerException;
|
||||
@@ -313,7 +313,7 @@ public class UIViewOperationQueue {
|
||||
try {
|
||||
mNativeViewHierarchyManager.dispatchCommand(mTag, mCommand, mArgs);
|
||||
} catch (Throwable e) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new RuntimeException("Error dispatching View Command", e));
|
||||
}
|
||||
}
|
||||
@@ -354,7 +354,7 @@ public class UIViewOperationQueue {
|
||||
try {
|
||||
mNativeViewHierarchyManager.dispatchCommand(mTag, mCommand, mArgs);
|
||||
} catch (Throwable e) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new RuntimeException("Error dispatching View Command", e));
|
||||
}
|
||||
}
|
||||
@@ -892,11 +892,12 @@ public class UIViewOperationQueue {
|
||||
mViewCommandOperations.add(op);
|
||||
} else {
|
||||
// Retryable exceptions should be logged, but never crash in debug.
|
||||
ReactSoftException.logSoftException(TAG, new ReactNoCrashSoftException(e));
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new ReactNoCrashSoftException(e));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// Non-retryable exceptions should be logged in prod, and crash in Debug.
|
||||
ReactSoftException.logSoftException(TAG, e);
|
||||
ReactSoftExceptionLogger.logSoftException(TAG, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -13,7 +13,7 @@ import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.uimanager.common.UIManagerType;
|
||||
@@ -84,7 +84,7 @@ public class ReactEventEmitter implements RCTModernEventEmitter {
|
||||
} else if (uiManagerType == UIManagerType.DEFAULT && getEventEmitter(reactTag) != null) {
|
||||
mRCTEventEmitter.receiveTouches(eventName, touches, changedIndices);
|
||||
} else {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Cannot find EventEmitter for receivedTouches: ReactTag["
|
||||
@@ -105,7 +105,7 @@ public class ReactEventEmitter implements RCTModernEventEmitter {
|
||||
if (mReactContext.hasActiveReactInstance()) {
|
||||
mRCTEventEmitter = mReactContext.getJSModule(RCTEventEmitter.class);
|
||||
} else {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Cannot get RCTEventEmitter from Context for reactTag: "
|
||||
@@ -127,7 +127,7 @@ public class ReactEventEmitter implements RCTModernEventEmitter {
|
||||
} else if (uiManagerType == UIManagerType.DEFAULT && getEventEmitter(targetReactTag) != null) {
|
||||
mRCTEventEmitter.receiveEvent(targetReactTag, eventName, event);
|
||||
} else {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Cannot find EventEmitter for receiveEvent: SurfaceId["
|
||||
|
||||
@@ -11,7 +11,7 @@ import android.view.MotionEvent;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.util.Pools;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.SoftAssertions;
|
||||
|
||||
/**
|
||||
@@ -148,7 +148,7 @@ public class TouchEvent extends Event<TouchEvent> {
|
||||
try {
|
||||
EVENTS_POOL.release(this);
|
||||
} catch (IllegalStateException e) {
|
||||
ReactSoftException.logSoftException(TAG, e);
|
||||
ReactSoftExceptionLogger.logSoftException(TAG, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public class TouchEvent extends Event<TouchEvent> {
|
||||
@Override
|
||||
public void dispatch(RCTEventEmitter rctEventEmitter) {
|
||||
if (!hasMotionEvent()) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException(
|
||||
"Cannot dispatch a TouchEvent that has no MotionEvent; the TouchEvent has been recycled"));
|
||||
|
||||
@@ -11,7 +11,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.core.util.Pools;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
import com.facebook.react.uimanager.events.Event;
|
||||
@@ -97,7 +97,7 @@ public class ScrollEvent extends Event<ScrollEvent> {
|
||||
} catch (IllegalStateException e) {
|
||||
// This exception can be thrown when an event is double-released.
|
||||
// This is a problem but won't cause user-visible impact, so it's okay to fail silently.
|
||||
ReactSoftException.logSoftException(TAG, e);
|
||||
ReactSoftExceptionLogger.logSoftException(TAG, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import androidx.annotation.Nullable;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.Arguments;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.bridge.WritableMap;
|
||||
import com.facebook.react.uimanager.NativeViewHierarchyOptimizer;
|
||||
@@ -116,7 +116,7 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
|
||||
.getJSModule(RCTEventEmitter.class)
|
||||
.receiveEvent(getReactTag(), "topTextLayout", event);
|
||||
} else {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
"ReactTextShadowNode",
|
||||
new ReactNoCrashSoftException("Cannot get RCTEventEmitter, no CatalystInstance"));
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableNativeMap;
|
||||
@@ -288,7 +288,7 @@ public class TextLayoutManager {
|
||||
} else if (boring != null && (unconstrainedWidth || boring.width <= width)) {
|
||||
int boringLayoutWidth = boring.width;
|
||||
if (boring.width < 0) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new ReactNoCrashSoftException("Text width is invalid: " + boring.width));
|
||||
boringLayoutWidth = 0;
|
||||
}
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.WritableArray;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.common.mapbuffer.ReadableMapBuffer;
|
||||
@@ -302,7 +302,7 @@ public class TextLayoutManagerMapBuffer {
|
||||
} else if (boring != null && (unconstrainedWidth || boring.width <= width)) {
|
||||
int boringLayoutWidth = boring.width;
|
||||
if (boring.width < 0) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG, new ReactNoCrashSoftException("Text width is invalid: " + boring.width));
|
||||
boringLayoutWidth = 0;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ import androidx.core.view.ViewCompat;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import com.facebook.react.uimanager.FabricViewStateManager;
|
||||
import com.facebook.react.uimanager.ReactAccessibilityDelegate;
|
||||
@@ -1035,7 +1035,7 @@ public class ReactEditText extends AppCompatEditText
|
||||
try {
|
||||
sb.append(currentText.subSequence(0, currentText.length()));
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
ReactSoftException.logSoftException(TAG, e);
|
||||
ReactSoftExceptionLogger.logSoftException(TAG, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@ import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.Dynamic;
|
||||
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.bridge.ReadableMap;
|
||||
import com.facebook.react.bridge.ReadableNativeMap;
|
||||
@@ -578,7 +578,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
view.setTextColor(defaultContextTextColor);
|
||||
} else {
|
||||
Context c = view.getContext();
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new IllegalStateException(
|
||||
"Could not get default text color from View Context: "
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReactNoCrashSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftException;
|
||||
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import com.facebook.react.modules.i18nmanager.I18nUtil;
|
||||
@@ -576,7 +576,7 @@ public class ReactViewGroup extends ViewGroup
|
||||
@Override
|
||||
public void run() {
|
||||
if (!child.isShown()) {
|
||||
ReactSoftException.logSoftException(
|
||||
ReactSoftExceptionLogger.logSoftException(
|
||||
TAG,
|
||||
new ReactNoCrashSoftException(
|
||||
"Child view has been added to Parent view in which it is clipped and not visible."
|
||||
|
||||
Reference in New Issue
Block a user