From c7791b9a38111b9324bb7647afecbfde7c59b3a6 Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Fri, 30 Aug 2019 09:43:23 -0300 Subject: [PATCH] [FIX] Fix calls to bugsnag.notify (#1165) --- app/containers/MessageActions.js | 8 ++++---- app/containers/MessageBox/index.js | 12 ++++++------ app/lib/methods/getSlashCommands.js | 4 ++-- app/lib/methods/sendFileMessage.js | 18 +++++++++--------- app/presentation/ServerItem/index.js | 3 +-- app/views/NotificationPreferencesView/index.js | 8 ++++---- app/views/RoomInfoView/index.js | 4 ++-- 7 files changed, 28 insertions(+), 29 deletions(-) diff --git a/app/containers/MessageActions.js b/app/containers/MessageActions.js index 11002f25..161dbaf4 100644 --- a/app/containers/MessageActions.js +++ b/app/containers/MessageActions.js @@ -310,8 +310,8 @@ class MessageActions extends React.Component { try { await RocketChat.reportMessage(actionMessage._id); Alert.alert(I18n.t('Message_Reported')); - } catch (err) { - log(err); + } catch (e) { + log(e); } } @@ -327,8 +327,8 @@ class MessageActions extends React.Component { if (!translatedMessage) { await RocketChat.translateMessage(actionMessage, room.autoTranslateLanguage); } - } catch (err) { - log(err); + } catch (e) { + log(e); } } diff --git a/app/containers/MessageBox/index.js b/app/containers/MessageBox/index.js index e4002bae..58637c09 100644 --- a/app/containers/MessageBox/index.js +++ b/app/containers/MessageBox/index.js @@ -293,7 +293,7 @@ class MessageBox extends Component { try { RocketChat.executeCommandPreview(command, params, rid, item); } catch (e) { - log('onPressCommandPreview', e); + log(e); } } @@ -468,7 +468,7 @@ class MessageBox extends Component { this.setState({ commandPreview: preview.items }); } catch (e) { this.showCommandPreview = false; - log('command Preview', e); + log(e); } } @@ -546,9 +546,9 @@ class MessageBox extends Component { mime: res.type, path: res.uri }); - } catch (error) { - if (!DocumentPicker.isCancel(error)) { - log('chooseFile', error); + } catch (e) { + if (!DocumentPicker.isCancel(e)) { + log(e); } } } @@ -655,7 +655,7 @@ class MessageBox extends Component { const messageWithoutCommand = message.substr(message.indexOf(' ') + 1); RocketChat.runSlashCommand(command, roomId, messageWithoutCommand); } catch (e) { - log('slashCommand', e); + log(e); } this.clearInput(); return; diff --git a/app/lib/methods/getSlashCommands.js b/app/lib/methods/getSlashCommands.js index 53293cae..b1806c7e 100644 --- a/app/lib/methods/getSlashCommands.js +++ b/app/lib/methods/getSlashCommands.js @@ -10,7 +10,7 @@ export default function() { const result = await this.sdk.get('commands.list'); if (!result.success) { - log('getSlashCommand fetch', result); + console.log(result); return resolve(); } @@ -22,7 +22,7 @@ export default function() { try { database.create('slashCommand', command, true); } catch (e) { - log('get_slash_command', e); + log(e); } })); return resolve(); diff --git a/app/lib/methods/sendFileMessage.js b/app/lib/methods/sendFileMessage.js index 98c99b16..19daec82 100644 --- a/app/lib/methods/sendFileMessage.js +++ b/app/lib/methods/sendFileMessage.js @@ -100,30 +100,30 @@ export function sendFileMessage(rid, fileInfo, tmid, server, user) { database.create('uploads', fileInfo, true); const response = JSON.parse(xhr.response); reject(response); - } catch (err) { - reject(err); - log(err); + } catch (e) { + reject(e); + log(e); } }); } }; - xhr.onerror = (e) => { + xhr.onerror = (error) => { database.write(() => { fileInfo.error = true; try { database.create('uploads', fileInfo, true); + reject(error); + } catch (e) { reject(e); - } catch (err) { - reject(err); - log(err); + log(e); } }); }; xhr.send(formData); - } catch (err) { - log(err); + } catch (e) { + log(e); } }); } diff --git a/app/presentation/ServerItem/index.js b/app/presentation/ServerItem/index.js index 644fa1a2..1a3d7e25 100644 --- a/app/presentation/ServerItem/index.js +++ b/app/presentation/ServerItem/index.js @@ -4,7 +4,6 @@ import { View, Text } from 'react-native'; import FastImage from 'react-native-fast-image'; import { RectButton } from 'react-native-gesture-handler'; -import log from '../../utils/log'; import Check from '../../containers/Check'; import styles, { ROW_HEIGHT } from './styles'; @@ -24,7 +23,7 @@ const ServerItem = React.memo(({ }} defaultSource={{ uri: 'logo' }} style={styles.serverIcon} - onError={() => log('err_loading_server_icon')} + onError={() => console.log('err_loading_server_icon')} /> ) : ( diff --git a/app/views/NotificationPreferencesView/index.js b/app/views/NotificationPreferencesView/index.js index c3337fa2..bb77addd 100644 --- a/app/views/NotificationPreferencesView/index.js +++ b/app/views/NotificationPreferencesView/index.js @@ -128,8 +128,8 @@ export default class NotificationPreferencesView extends React.Component { }; try { await RocketChat.saveNotificationSettings(this.rid, params); - } catch (err) { - log('err_save_notification_settings', err); + } catch (e) { + log(e); } } @@ -142,8 +142,8 @@ export default class NotificationPreferencesView extends React.Component { }; try { await RocketChat.saveNotificationSettings(this.rid, params); - } catch (err) { - log('err_save_notification_settings', err); + } catch (e) { + log(e); } } diff --git a/app/views/RoomInfoView/index.js b/app/views/RoomInfoView/index.js index 92baa9ff..70aba107 100644 --- a/app/views/RoomInfoView/index.js +++ b/app/views/RoomInfoView/index.js @@ -98,8 +98,8 @@ class RoomInfoView extends React.Component { room = result.room; this.setState({ room }); } - } catch (error) { - log('err_get_room_info', error); + } catch (e) { + log(e); } } const permissions = RocketChat.hasPermission([PERMISSION_EDIT_ROOM], room.rid);