Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ class SentryReactNativeHostHandlerTest {
val handler = handlerWithoutExpoUpdates()
val originalException = RuntimeException("test")

val thrown = assertThrows(RuntimeException::class.java) {
handler.onReactInstanceException(false, originalException)
}
val thrown =
assertThrows(RuntimeException::class.java) {
handler.onReactInstanceException(false, originalException)
}
assertSame(originalException, thrown)

sentryMock!!.verify({ Sentry.captureException(any()) }, never())
Expand All @@ -86,9 +87,10 @@ class SentryReactNativeHostHandlerTest {
val handler = handlerWithoutExpoUpdates()
val originalException = IllegalStateException("Fabric crash")

val thrown = assertThrows(IllegalStateException::class.java) {
handler.onReactInstanceException(false, originalException)
}
val thrown =
assertThrows(IllegalStateException::class.java) {
handler.onReactInstanceException(false, originalException)
}
assertSame(originalException, thrown)

val captor = argumentCaptor<Throwable>()
Expand All @@ -113,7 +115,8 @@ class SentryReactNativeHostHandlerTest {
sentryMock =
mockStatic(Sentry::class.java).also {
it.`when`<Boolean> { Sentry.isEnabled() }.thenReturn(true)
it.`when`<Any> { Sentry.captureException(any()) }
it
.`when`<Any> { Sentry.captureException(any()) }
.thenThrow(RuntimeException("Sentry internal error"))
}

Expand All @@ -122,9 +125,10 @@ class SentryReactNativeHostHandlerTest {

// Sentry's internal failure must be swallowed, but the original native exception is still
// rethrown so Android's UncaughtExceptionHandler can terminate the process.
val thrown = assertThrows(IllegalStateException::class.java) {
handler.onReactInstanceException(false, originalException)
}
val thrown =
assertThrows(IllegalStateException::class.java) {
handler.onReactInstanceException(false, originalException)
}
assertSame(originalException, thrown)
}

Expand Down
3 changes: 2 additions & 1 deletion samples/expo/app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function InfoButton({ colorScheme }: { colorScheme: string }) {
color: Colors[colorScheme === 'dark' ? 'dark' : 'light'].text,
marginRight: 15,
opacity: pressed ? 0.5 : 1,
}}>
}}
>
</Text>
)}
Expand Down
2 changes: 1 addition & 1 deletion samples/expo/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DarkTheme, DefaultTheme, ThemeProvider } from 'expo-router/react-navigation';
import * as Sentry from '@sentry/react-native';
import { isRunningInExpoGo } from 'expo';
import * as ImagePicker from 'expo-image-picker';
import { SplashScreen, Stack } from 'expo-router';
import { DarkTheme, DefaultTheme, ThemeProvider } from 'expo-router/react-navigation';
import { useEffect } from 'react';
import { LogBox } from 'react-native';

Expand Down
Loading