Skip to content

Commit

Permalink
[#1515] Capturing Errors in mobile Home page
Browse files Browse the repository at this point in the history
  • Loading branch information
ifirmawan committed May 28, 2024
1 parent 54b4795 commit f5ab8bd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/src/pages/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as Notifications from 'expo-notifications';
import * as Location from 'expo-location';
import PropTypes from 'prop-types';
import * as Network from 'expo-network';
import * as Sentry from '@sentry/react-native';

import { BaseLayout } from '../components';
import {
FormState,
Expand Down Expand Up @@ -95,6 +97,8 @@ const Home = ({ navigation, route }) => {
s.isManualSynced = true;
});
} catch (error) {
Sentry.captureMessage('[Home] Unable sync all forms');
Sentry.captureException(error);
Promise.reject(error);
}
};
Expand Down Expand Up @@ -146,6 +150,8 @@ const Home = ({ navigation, route }) => {
setSyncLoading(false);
} catch (error) {
ToastAndroid.show(`[ERROR SYNC DATAPOINT]: ${error}`, ToastAndroid.LONG);
Sentry.captureMessage('[Home] Unable to sync data-points');
Sentry.captureException(error);
setSyncLoading(false);
}
};
Expand Down Expand Up @@ -184,6 +190,8 @@ const Home = ({ navigation, route }) => {
setData(forms);
setloading(false);
} catch (error) {
Sentry.captureMessage("[Home] Unable to refresh user's forms");
Sentry.captureException(error);
if (Platform.OS === 'android') {
ToastAndroid.show(`SQL: ${error}`, ToastAndroid.SHORT);
}
Expand Down Expand Up @@ -245,7 +253,6 @@ const Home = ({ navigation, route }) => {
timeInterval,
},
(res) => {
console.info('[CURRENT LOC]', res?.coords);
UserState.update((s) => {
s.currentLocation = res;
});
Expand Down

0 comments on commit f5ab8bd

Please sign in to comment.