Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • benhayward.ben/mobile-native
  • minds/mobile-native
  • msantang78/mobile-native
  • edgebal/mobile-native
  • msantang78_test/mobile-native
  • duyquoc/mobile-native
  • priestd09/mobile-native
  • eiennohi/mobile-native
  • omadrid/mobile-native
  • sieuhuflit/mobile-native
  • juanmsolaro/mobile-native
  • ascenderking/mobile-native
  • jim-toth/mobile-native
  • thinnakrit/mobile-native-lang
  • project_connection/mobile-native
  • AaronTheBruce/mobile-native
  • cormac.kantargis.hack/mobile-native
  • xthread/mobile-native
  • Paulnguyenun/mobile-native
  • lustigdev/mobile-native
  • GubbenOlsson/mobile-native
  • calvinoea/mobile-native
  • namesty/mobile-native
  • mrrobot16/mobile-native
  • eliobricenov/mobile-native
  • bedriguler/mobile-native
  • m994/mobile-native
  • threetoes/mobile-native
  • liangel/mobile-native
  • hosituan/mobile-native
  • nacef.otay/mobile-native
  • madibaa/mobile-native
  • valentin129/mobile-native
  • manishoo/mobile-native1
34 results
Show changes
Commits on Source (2)
......@@ -12,6 +12,7 @@ import logService from './src/common/services/log.service';
import * as Sentry from '@sentry/react-native';
import { isAbort, isNetworkFail } from './src/common/helpers/abortableFetch';
import { isApiError } from './src/common/services/api.service';
import { isUserError } from './src/common/UserError';
// Init Sentry (if not running test)
......@@ -33,6 +34,10 @@ if (process.env.JEST_WORKER_ID === undefined) {
if (isAbort(hint.originalException)) {
return null;
}
// ignore user errors
if (isUserError(hint.originalException)) {
return null;
}
// only log api 500 errors
if (isApiError(hint.originalException) && hint.originalException.status < 500) {
return null;
......
import {
Alert,
} from 'react-native';
export class UserError extends Error {
constructor(...args) {
super(...args)
Alert.alert(
'',
`
${args[0]}
`,
[{
text: 'Ok',
}]
);
}
}
export const isUserError = function(err) {
return err instanceof UserError;
}
......@@ -8,6 +8,7 @@ import settingsStore from '../../settings/SettingsStore';
import * as Sentry from '@sentry/react-native';
import { isNetworkFail } from '../helpers/abortableFetch';
import { ApiError } from './api.service';
import { isUserError } from '../UserError';
const parseErrorStack = error => {
if (!error || !error.stack) {
......@@ -76,7 +77,7 @@ class LogService {
prepend = null;
}
if (!isNetworkFail(error) && (!this.isApiError(error) || this.isUnexpectedError(error))) {
if (!isNetworkFail(error) && !isUserError(error) && (!this.isApiError(error) || this.isUnexpectedError(error))) {
// report the issue to sentry
Sentry.captureException(error);
}
......
import api from './../../common/services/api.service';
import logService from './log.service';
import i18n from './i18n.service';
import { UserError } from '../UserError';
export function vote(guid, direction, data) {
return api.put('api/v1/votes/' + guid + '/' + direction, data)
......@@ -9,6 +10,6 @@ export function vote(guid, direction, data) {
})
.catch(err => {
logService.exception('[VotesService]', err);
throw new Error(i18n.t('errorMessage'));
throw new UserError(i18n.t('errorMessage'));
})
}
......@@ -18,6 +18,7 @@ import sessionService from '../../common/services/session.service';
import imagePicker from '../../common/services/image-picker.service';
import withPreventDoubleTap from '../../common/components/PreventDoubleTap';
import i18n from '../../common/services/i18n.service';
import { UserError } from '../../common/UserError';
const TouchableCustom = withPreventDoubleTap(TouchableOpacity);
......@@ -72,7 +73,7 @@ export default class ChannelSetupStep extends Component {
}
save = async () => {
if (this.store.isUploading) throw Error('Avatar is uploading, please wait');
if (this.store.isUploading) throw new UserError('Avatar is uploading, please wait');
if (!this.state.dirty) return;
payload = {
briefdescription: this.state.briefdescription,
......