mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Have BatchMountItem log the exact item that crashes
Summary: Because BatchMountItem executes many items, sometimes it's unclear which MountItem causes a crash. Catch and log the exact item. This shouldn't cause perf regressions because we have a try/catch block in FabricUIManager where execute is called. Changelog: [Internal] Reviewed By: shergin Differential Revision: D23775500 fbshipit-source-id: c878e085c23d3d3a7ef02a34e5aca57759376aa6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fa44c46e37
commit
03448715af
+15
-2
@@ -8,6 +8,7 @@
|
||||
package com.facebook.react.fabric.mounting.mountitems;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.bridge.ReactMarker;
|
||||
import com.facebook.react.bridge.ReactMarkerConstants;
|
||||
@@ -70,8 +71,20 @@ public class BatchMountItem implements MountItem {
|
||||
public void execute(@NonNull MountingManager mountingManager) {
|
||||
beginMarkers("mountViews");
|
||||
|
||||
for (int mountItemIndex = 0; mountItemIndex < mSize; mountItemIndex++) {
|
||||
mMountItems[mountItemIndex].execute(mountingManager);
|
||||
int mountItemIndex = 0;
|
||||
try {
|
||||
for (; mountItemIndex < mSize; mountItemIndex++) {
|
||||
mMountItems[mountItemIndex].execute(mountingManager);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
FLog.e(
|
||||
TAG,
|
||||
"Caught exception executing mountItem @"
|
||||
+ mountItemIndex
|
||||
+ ": "
|
||||
+ mMountItems[mountItemIndex].toString(),
|
||||
e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
endMarkers();
|
||||
|
||||
Reference in New Issue
Block a user