Skip to content

Commit

Permalink
fix: Don't track location errors on Sentry (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Nov 9, 2019
1 parent 47341f7 commit c416d0f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion App/Screens/ErrorScreen/ErrorScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,21 @@ const styles = StyleSheet.create({
}
});

// We don't send the following errors to Sentry
const UNTRACKED_ERRORS = [
'Error: Permission to access location was denied',
'Error: Location provider is unavailable. Make sure that location services are enabled.',
'Error: Location request timed out.',
'Error: Location request failed due to unsatisfied device settings.'
];

export function ErrorScreen(props: ErrorScreenProps) {
const { error } = useContext(ErrorContext);

trackScreen('ERROR');

useEffect(() => {
if (error) {
if (error && !UNTRACKED_ERRORS.includes(error)) {
Sentry.captureException(new Error(error));
}
}, []);
Expand Down
2 changes: 1 addition & 1 deletion App/Screens/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import * as TE from 'fp-ts/lib/TaskEither';
import React, { useContext, useState } from 'react';
import { FlatList, StyleSheet, Text, View } from 'react-native';
import { NavigationInjectedProps } from 'react-navigation';
import Sentry from 'sentry-expo';
import * as Sentry from 'sentry-expo';

import { BackButton, ListSeparator } from '../../components';
import { CurrentLocationContext, GpsLocationContext } from '../../stores';
Expand Down

0 comments on commit c416d0f

Please sign in to comment.