File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
sentry-android-replay/src
main/java/io/sentry/android/replay/viewhierarchy
test/java/io/sentry/android/replay/viewhierarchy Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -55,11 +55,14 @@ internal object ComposeViewHierarchyNode {
5555 internal fun retrieveSemanticsConfiguration (node : LayoutNode ): SemanticsConfiguration ? {
5656 try {
5757 return node.semanticsConfiguration
58- } catch (_ : Throwable ) {
58+ } catch (t : Throwable ) {
5959 // for backwards compatibility
6060 // Jetpack Compose 1.8 or older
61- return getCollapsedSemanticsMethod?.let {
62- return it.invoke(node) as SemanticsConfiguration ?
61+ return if (getCollapsedSemanticsMethod != null ) {
62+ getCollapsedSemanticsMethod!! .invoke(node) as SemanticsConfiguration
63+ } else {
64+ // re-throw t if there's no way to retrieve semantics
65+ throw t
6366 }
6467 }
6568 }
Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.GenericViewHiera
4444import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.ImageViewHierarchyNode
4545import io.sentry.android.replay.viewhierarchy.ViewHierarchyNode.TextViewHierarchyNode
4646import java.io.File
47- import java.lang.reflect.InvocationTargetException
4847import kotlin.test.Test
4948import kotlin.test.assertEquals
5049import kotlin.test.assertFalse
@@ -183,7 +182,7 @@ class ComposeMaskingOptionsTest {
183182 val node = mock<LayoutNode >()
184183 whenever(node.semanticsConfiguration).thenThrow(RuntimeException (" Compose Runtime Error" ))
185184
186- assertThrows(InvocationTargetException ::class .java) {
185+ assertThrows(RuntimeException ::class .java) {
187186 ComposeViewHierarchyNode .retrieveSemanticsConfiguration(node)
188187 }
189188 }
You can’t perform that action at this time.
0 commit comments