Collect more diagnostics when addViewAt crashes

Summary:
Making error more explicit to assist in debugging.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D22929047

fbshipit-source-id: 4f26668a96868e7c5865a587142c3bcd10a26c90
This commit is contained in:
Joshua Gross
2020-08-04 14:15:34 -07:00
committed by Facebook GitHub Bot
parent 6c01f26d27
commit 7bf6196408
@@ -156,7 +156,19 @@ public class MountingManager {
logViewHierarchy(parentView);
}
getViewGroupManager(parentViewState).addView(parentView, view, index);
try {
getViewGroupManager(parentViewState).addView(parentView, view, index);
} catch (IllegalStateException e) {
// Wrap error with more context for debugging
throw new IllegalStateException(
"addViewAt: failed to insert view ["
+ tag
+ "] into parent ["
+ parentTag
+ "] at index "
+ index,
e);
}
// Display children after inserting
if (SHOW_CHANGED_VIEW_HIERARCHIES) {