Update error tracing

This commit is contained in:
Zhiyuan Zheng 2022-05-18 00:11:31 +02:00
parent 051dc7be8c
commit 4dcc561cbf
5 changed files with 23 additions and 13 deletions

View File

@ -54,6 +54,7 @@ import { enableFreeze } from 'react-native-screens'
import { QueryClientProvider } from 'react-query'
import { Provider } from 'react-redux'
import { PersistGate } from 'redux-persist/integration/react'
import * as Sentry from 'sentry-expo'
Platform.select({
android: LogBox.ignoreLogs(['Setting a timer for a long period of time'])
@ -128,13 +129,15 @@ const App: React.FC = () => {
}
return (
<ActionSheetProvider>
<AccessibilityManager>
<ThemeManager>
<Screens localCorrupt={localCorrupt} />
</ThemeManager>
</AccessibilityManager>
</ActionSheetProvider>
<Sentry.Native.TouchEventBoundary>
<ActionSheetProvider>
<AccessibilityManager>
<ThemeManager>
<Screens localCorrupt={localCorrupt} />
</ThemeManager>
</AccessibilityManager>
</ActionSheetProvider>
</Sentry.Native.TouchEventBoundary>
)
} else {
return null

View File

@ -22,7 +22,7 @@ const TimelineActioned = React.memo(
const { colors } = useTheme()
const navigation =
useNavigation<StackNavigationProp<TabLocalStackParamList>>()
const name = account.display_name || account.username
const name = account?.display_name || account.username
const iconColor = colors.primaryDefault
const content = (content: string) => (

View File

@ -377,7 +377,12 @@ const ScreenCompose: React.FC<RootStackScreenProps<'Screen-Compose'>> = ({
]
)
} else {
Sentry.Native.captureMessage('Compose posting', error)
Sentry.Native.captureMessage('Compose posting', {
contexts: {
errorObject: error,
errorString: error.toString()
}
})
haptics('Error')
composeDispatch({ type: 'posting', payload: false })
Alert.alert(t('heading.right.alert.default.title'), undefined, [

View File

@ -35,7 +35,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
result.data.pages.flatMap(d => [...d.body])
: []
// Auto go back when toot page is empty
if (flattenData.length === 0) {
if (flattenData.length < 1) {
navigation.goBack()
return
}
@ -46,13 +46,14 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
if (pointer < 1) return
try {
setTimeout(() => {
console.log('scrolling')
flRef.current?.scrollToIndex({
index: pointer,
viewOffset: 100
})
}, 500)
} catch {}
} catch (error) {
return
}
}
}
})

View File

@ -7,7 +7,8 @@ const sentry = () => {
Sentry.init({
dsn: 'https://53348b60ff844d52886e90251b3a5f41@o917354.ingest.sentry.io/6410576',
enableInExpoDevelopment: false,
debug: !isRelease
debug: !isRelease,
autoSessionTracking: true
})
}