Skip to content

Commit

Permalink
fix: Add sentry logs on errors (#269) (#270)
Browse files Browse the repository at this point in the history
* fix: Add sentry logs on errors

* Only track sentry on mount

* Add revisionId in about
  • Loading branch information
amaury1093 authored Oct 7, 2019
1 parent 44d708c commit 2841dae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion App/Screens/About/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export function About (props: AboutProps) {
</Text>
.{'\n'}
{'\n'}
Sh**t! I Smoke v{Constants.manifest.version}.
Sh**t! I Smoke v{Constants.manifest.version} (#{Constants.manifest.revisionId || 'development'}).
</Text>
{/* Add languages https://github.com/amaurymartiny/shoot-i-smoke/issues/73 */}
</View>
Expand Down
11 changes: 9 additions & 2 deletions App/Screens/ErrorScreen/ErrorScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with Sh**t! I Smoke. If not, see <http://www.gnu.org/licenses/>.

import React, { useContext } from 'react';
import { Image, StyleSheet, Text, View } from 'react-native';
import React, { useContext, useEffect } from 'react';
import { NavigationInjectedProps } from 'react-navigation';
import { Image, StyleSheet, Text, View } from 'react-native';
import { scale } from 'react-native-size-matters';
import * as Sentry from 'sentry-expo';

import errorPicture from '../../../assets/images/error.png';
import { Button } from '../../components';
Expand All @@ -33,6 +34,12 @@ export function ErrorScreen (props: ErrorScreenProps) {

trackScreen('ERROR');

useEffect(() => {
if (error) {
Sentry.captureException(new Error(error));
}
}, []);

return (
<View style={styles.container}>
<Image source={errorPicture} />
Expand Down
2 changes: 1 addition & 1 deletion App/util/fp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as TE from 'fp-ts/lib/TaskEither';
import { pipe } from 'fp-ts/lib/pipeable';
import { capDelay, limitRetries, RetryStatus } from 'retry-ts';
import { retrying } from 'retry-ts/lib/Task';
import Sentry from 'sentry-expo';
import * as Sentry from 'sentry-expo';

import { noop } from './noop';

Expand Down

0 comments on commit 2841dae

Please sign in to comment.