[FIX] Analytics error events (#930)

This commit is contained in:
Diego Mello 2019-05-28 13:18:46 -03:00 committed by GitHub
parent 9e4a4d2454
commit a148e6d15d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 104 additions and 95 deletions

View File

@ -308,7 +308,7 @@ export default class MessageActions extends React.Component {
await RocketChat.reportMessage(actionMessage._id);
Alert.alert(I18n.t('Message_Reported'));
} catch (err) {
log('report message', err);
log('err_report_message', err);
}
}

View File

@ -290,7 +290,7 @@ class MessageBox extends Component {
try {
database.create('users', user, true);
} catch (e) {
log('create users', e);
log('err_create_users', e);
}
});
});
@ -414,7 +414,7 @@ class MessageBox extends Component {
try {
await RocketChat.sendFileMessage(rid, fileInfo, tmid);
} catch (e) {
log('sendImageMessage', e);
log('err_send_image', e);
}
}
@ -423,7 +423,7 @@ class MessageBox extends Component {
const image = await ImagePicker.openCamera(imagePickerConfig);
this.showUploadModal(image);
} catch (e) {
log('takePhoto', e);
log('err_take_photo', e);
}
}
@ -432,7 +432,7 @@ class MessageBox extends Component {
const image = await ImagePicker.openPicker(imagePickerConfig);
this.showUploadModal(image);
} catch (e) {
log('chooseFromLibrary', e);
log('err_choose_from_library', e);
}
}
@ -492,7 +492,7 @@ class MessageBox extends Component {
if (e && e.error === 'error-file-too-large') {
return Alert.alert(I18n.t(e.error));
}
log('finishAudioMessage', e);
log('err_finish_audio_message', e);
}
}
}

View File

@ -66,7 +66,7 @@ export default async function() {
database.delete(emojiRecord);
}
} catch (e) {
log('getEmojis delete', e);
log('err_get_emojis_delete', e);
}
});
}
@ -74,6 +74,6 @@ export default async function() {
);
}
} catch (e) {
log('getCustomEmojis', e);
log('err_get_custom_emojis', e);
}
}

View File

@ -16,7 +16,7 @@ const create = (permissions) => {
try {
database.create('permissions', permission, true);
} catch (e) {
log('getPermissions create', e);
log('err_get_permissions_create', e);
}
});
}
@ -63,7 +63,7 @@ export default async function() {
database.delete(permission);
}
} catch (e) {
log('getPermissions delete', e);
log('err_get_permissions_delete', e);
}
});
}
@ -71,6 +71,6 @@ export default async function() {
);
}
} catch (e) {
log('getPermissions', e);
log('err_get_permissions', e);
}
}

View File

@ -20,12 +20,12 @@ export default async function() {
try {
database.create('roles', role, true);
} catch (e) {
log('getRoles create', e);
log('err_get_roles_create', e);
}
}));
});
}
} catch (e) {
log('getRoles', e);
log('err_get_roles', e);
}
}

View File

@ -11,7 +11,7 @@ function updateServer(param) {
try {
database.databases.serversDB.create('servers', { id: reduxStore.getState().server.server, ...param }, true);
} catch (e) {
log('updateServer', e);
log('err_get_settings_update_server', e);
}
});
}
@ -34,7 +34,7 @@ export default async function() {
try {
database.create('settings', { ...setting, _updatedAt: new Date() }, true);
} catch (e) {
log('create settings', e);
log('err_get_settings_create', e);
}
if (setting._id === 'Site_Name') {
@ -52,6 +52,6 @@ export default async function() {
updateServer.call(this, { iconURL });
}
} catch (e) {
log('getSettings', e);
log('err_get_settings', e);
}
}

View File

@ -52,7 +52,7 @@ export default function loadMessagesForRoom(...args) {
database.create('threadMessages', message, true);
}
} catch (e) {
log('loadMessagesForRoom -> create messages', e);
log('err_load_messages_for_room_create', e);
}
}));
return resolve(data);
@ -61,7 +61,7 @@ export default function loadMessagesForRoom(...args) {
return resolve([]);
}
} catch (e) {
log('loadMessagesForRoom', e);
log('err_load_messages_for_room', e);
reject(e);
}
});

View File

@ -45,7 +45,7 @@ export default function loadMissedMessages(...args) {
database.create('threadMessages', message, true);
}
} catch (e) {
log('loadMissedMessages -> create messages', e);
log('err_load_missed_messages_create', e);
}
}));
});
@ -65,14 +65,14 @@ export default function loadMissedMessages(...args) {
});
});
} catch (e) {
log('loadMissedMessages -> delete message', e);
log('err_load_missed_messages_delete', e);
}
});
}
}
resolve();
} catch (e) {
log('loadMissedMessages', e);
log('err_load_missed_messages', e);
reject(e);
}
});

View File

@ -34,7 +34,7 @@ export default function loadThreadMessages({ tmid, offset = 0 }) {
message.rid = tmid;
database.create('threadMessages', message, true);
} catch (e) {
log('loadThreadMessages -> create messages', e);
log('err_load_thread_messages_create', e);
}
}));
return resolve(data);
@ -43,7 +43,7 @@ export default function loadThreadMessages({ tmid, offset = 0 }) {
return resolve([]);
}
} catch (e) {
log('loadThreadMessages', e);
log('err_load_thread_messages', e);
reject(e);
}
});

View File

@ -18,6 +18,6 @@ export default async function readMessages(rid) {
});
return data;
} catch (e) {
log('readMessages', e);
log('err_read_messages', e);
}
}

View File

@ -51,7 +51,7 @@ export async function sendFileMessage(rid, fileInfo, tmid) {
try {
database.create('uploads', fileInfo, true);
} catch (e) {
return log('sendFileMessage -> create uploads 1', e);
return log('err_send_file_message_create_upload_1', e);
}
});
@ -69,7 +69,7 @@ export async function sendFileMessage(rid, fileInfo, tmid) {
try {
database.create('uploads', fileInfo, true);
} catch (e) {
return log('sendFileMessage -> create uploads 2', e);
return log('err_send_file_message_create_upload_2', e);
}
});
});
@ -95,7 +95,7 @@ export async function sendFileMessage(rid, fileInfo, tmid) {
try {
database.delete(upload);
} catch (e) {
log('sendFileMessage -> delete uploads', e);
log('err_send_file_message_delete_upload', e);
}
});
} catch (e) {
@ -104,7 +104,7 @@ export async function sendFileMessage(rid, fileInfo, tmid) {
try {
database.create('uploads', fileInfo, true);
} catch (err) {
log('sendFileMessage -> create uploads 3', err);
log('err_send_file_message_create_upload_3', err);
}
});
}

View File

@ -66,6 +66,6 @@ export default async function(rid, msg, tmid) {
});
}
} catch (e) {
log('sendMessage', e);
log('err_send_message', e);
}
}

View File

@ -63,7 +63,7 @@ export default function subscribeRoom({ rid }) {
typingTimeouts[username] = null;
}
} catch (error) {
console.log('TCL: removeUserTyping -> error', error);
log('err_remove_user_typing', error);
}
};
@ -85,7 +85,7 @@ export default function subscribeRoom({ rid }) {
removeUserTyping(username);
}, 10000);
} catch (error) {
console.log('TCL: addUserTyping -> error', error);
log('err_add_user_typing', error);
}
}
};
@ -198,7 +198,7 @@ export default function subscribeRoom({ rid }) {
try {
promises = this.sdk.subscribeRoom(rid);
} catch (e) {
log('subscribeRoom', e);
log('err_subscribe_room', e);
}
return {

View File

@ -59,7 +59,7 @@ export default async function subscribeRooms() {
database.delete(subscription);
});
} catch (e) {
log('handleStreamMessageReceived -> subscriptions removed', e);
log('err_stream_msg_received_sub_removed', e);
}
} else {
const rooms = database.objects('rooms').filtered('_id == $0', data.rid);
@ -70,7 +70,7 @@ export default async function subscribeRooms() {
database.delete(rooms);
});
} catch (e) {
log('handleStreamMessageReceived -> subscriptions updated', e);
log('err_stream_msg_received_sub_updated', e);
}
}
}
@ -83,7 +83,7 @@ export default async function subscribeRooms() {
database.create('subscriptions', tmp, true);
});
} catch (e) {
log('handleStreamMessageReceived -> rooms updated', e);
log('err_stream_msg_received_room_updated', e);
}
} else if (type === 'inserted') {
try {
@ -91,7 +91,7 @@ export default async function subscribeRooms() {
database.create('rooms', data, true);
});
} catch (e) {
log('handleStreamMessageReceived -> rooms inserted', e);
log('err_stream_msg_received_room_inserted', e);
}
}
}
@ -116,7 +116,7 @@ export default async function subscribeRooms() {
database.create('messages', message, true);
});
} catch (e) {
log('handleStreamMessageReceived -> message', e);
log('err_stream_msg_received_message', e);
}
});
}
@ -146,7 +146,7 @@ export default async function subscribeRooms() {
try {
await this.sdk.subscribeNotifyUser();
} catch (e) {
log('subscribeRooms', e);
log('err_subscribe_rooms', e);
}
return {

View File

@ -96,7 +96,7 @@ const RocketChat = {
return result;
}
} catch (e) {
log('getServerInfo', e);
log('err_get_server_info', e);
}
return {
success: false,
@ -387,7 +387,7 @@ const RocketChat = {
database.create('messages', message, true);
});
} catch (e) {
log('resendMessage error', e);
log('err_resend_message', e);
}
}
},
@ -514,7 +514,7 @@ const RocketChat = {
try {
room = await RocketChat.getRoom(message.rid);
} catch (e) {
log('Rocketchat.getPermalink', e);
log('err_get_permalink', e);
return null;
}
const { server } = reduxStore.getState().server;

View File

@ -38,7 +38,7 @@ const restore = function* restore() {
yield put(actions.appReady({}));
} catch (e) {
log('restore', e);
log('err_restore', e);
}
};

View File

@ -80,7 +80,7 @@ const handleLogout = function* handleLogout() {
yield put(appStart('outside'));
} catch (e) {
yield put(appStart('outside'));
log('handleLogout', e);
log('err_handle_logout', e);
}
}
};

View File

@ -77,7 +77,7 @@ const handleReplyBroadcast = function* handleReplyBroadcast({ message }) {
yield delay(500);
yield put(replyInit(message, false));
} catch (e) {
log('handleReplyBroadcast', e);
log('err_reply_broadcast', e);
}
};

View File

@ -24,7 +24,7 @@ const watchUserTyping = function* watchUserTyping({ rid, status }) {
yield RocketChat.emitTyping(rid, false);
}
} catch (e) {
log('watchUserTyping', e);
log('err_watch_user_typing', e);
}
};

View File

@ -23,7 +23,7 @@ const handleRoomsRequest = function* handleRoomsRequest() {
try {
database.create('subscriptions', subscription, true);
} catch (error) {
log('handleRoomsRequest create sub', error);
log('err_rooms_request_create_sub', error);
}
});
});
@ -31,14 +31,14 @@ const handleRoomsRequest = function* handleRoomsRequest() {
try {
database.databases.serversDB.create('servers', { id: server, roomsUpdatedAt: newRoomsUpdatedAt }, true);
} catch (e) {
log('handleRoomsRequest update roomsUpdatedAt', e);
log('err_rooms_request_update', e);
}
});
yield put(roomsSuccess());
} catch (e) {
yield put(roomsFailure(e));
log('handleRoomsRequest', e);
log('err_rooms_request', e);
}
};

View File

@ -26,7 +26,7 @@ const getServerInfo = function* getServerInfo({ server }) {
return serverInfo;
} catch (e) {
log('getServerInfo', e);
log('err_get_server_info', e);
}
};
@ -54,7 +54,7 @@ const handleSelectServer = function* handleSelectServer({ server, version, fetch
yield put(selectServerSuccess(server, fetchVersion ? serverInfo && serverInfo.version : version));
} catch (e) {
log('handleSelectServer', e);
log('err_select_server', e);
}
};
@ -73,7 +73,7 @@ const handleServerRequest = function* handleServerRequest({ server }) {
yield put(selectServerRequest(server, serverInfo.version, false));
} catch (e) {
yield put(serverFailure());
log('handleServerRequest', e);
log('err_server_request', e);
}
};

View File

@ -3,6 +3,7 @@ import { FOREGROUND, BACKGROUND } from 'redux-enhancer-react-native-appstate';
import RocketChat from '../lib/rocketchat';
import { setBadgeCount } from '../push';
import log from '../utils/log';
const appHasComeBackToForeground = function* appHasComeBackToForeground() {
const appRoot = yield select(state => state.app.root);
@ -17,7 +18,7 @@ const appHasComeBackToForeground = function* appHasComeBackToForeground() {
setBadgeCount();
return yield RocketChat.setUserPresenceOnline();
} catch (e) {
console.log('appHasComeBackToForeground', e);
log('err_app_has_come_back_to_foreground', e);
}
};
@ -33,7 +34,7 @@ const appHasComeBackToBackground = function* appHasComeBackToBackground() {
try {
return yield RocketChat.setUserPresenceAway();
} catch (e) {
console.log('appHasComeBackToBackground', e);
log('err_app_has_come_back_to_background', e);
}
};

View File

@ -31,7 +31,7 @@ class EventEmitter {
try {
listener.apply(this, args);
} catch (e) {
log('EventEmitter.emit', e);
log('err_emit', e);
}
});
}

View File

@ -75,7 +75,7 @@ export default class ProfileView extends React.Component {
const result = await RocketChat.getAvatarSuggestion();
this.setState({ avatarSuggestions: result });
} catch (e) {
log('getAvatarSuggestion', e);
log('err_get_avatar_suggestion', e);
}
}
@ -152,7 +152,7 @@ export default class ProfileView extends React.Component {
return showErrorAlert(e.data.error);
}
showErrorAlert(I18n.t('There_was_an_error_while_action', { action: I18n.t(action) }));
log(func, e);
// log(func, e);
}
submit = async() => {

View File

@ -73,7 +73,7 @@ export default class RoomActionsView extends React.Component {
this.setState({ room: { ...result.channel, rid: result.channel._id } });
}
} catch (error) {
console.log('RoomActionsView -> getChannelInfo -> error', error);
log('err_get_channel_info', error);
}
}
@ -84,7 +84,7 @@ export default class RoomActionsView extends React.Component {
this.setState({ membersCount: counters.members, joined: counters.joined });
}
} catch (error) {
console.log('RoomActionsView -> getRoomCounters -> error', error);
log('err_get_room_counters', error);
}
} else if (room.t === 'd') {
this.updateRoomMember();
@ -335,7 +335,7 @@ export default class RoomActionsView extends React.Component {
this.setState({ member: result.user });
}
} catch (e) {
log('RoomActions updateRoomMember', e);
log('err_update_room_member', e);
this.setState({ member: {} });
}
}
@ -347,7 +347,7 @@ export default class RoomActionsView extends React.Component {
try {
RocketChat.toggleBlockUser(rid, member._id, !blocker);
} catch (e) {
log('toggleBlockUser', e);
log('err_toggle_block_user', e);
}
}
@ -380,7 +380,7 @@ export default class RoomActionsView extends React.Component {
};
RocketChat.saveNotificationSettings(room.rid, notifications);
} catch (e) {
log('toggleNotifications', e);
log('err_toggle_notifications', e);
}
}

View File

@ -207,7 +207,7 @@ export default class RoomInfoEditView extends React.Component {
this.setState({ nameError: e });
}
error = true;
log('saveRoomSettings', e);
log('err_save_room_settings', e);
}
await this.setState({ saving: false });
@ -262,7 +262,7 @@ export default class RoomInfoEditView extends React.Component {
try {
await RocketChat.toggleArchiveRoom(rid, t, !archived);
} catch (e) {
log('toggleArchive', e);
log('err_toggle_archive', e);
}
}
}

View File

@ -98,7 +98,7 @@ export default class RoomInfoView extends React.Component {
this.setState({ roomUser: result.user });
}
} catch (error) {
log('RoomInfoView.getUserInfo', error);
log('err_get_user_info', error);
}
}
}

View File

@ -144,7 +144,7 @@ export default class RoomMembersView extends React.Component {
}
}
} catch (e) {
log('onPressUser', e);
log('err_on_press_user', e);
}
}
@ -175,7 +175,7 @@ export default class RoomMembersView extends React.Component {
this.fetchMembers();
});
} catch (e) {
log('RoomMembers.toggleStatus', e);
log('err_toggle_status', e);
}
}
@ -210,7 +210,7 @@ export default class RoomMembersView extends React.Component {
});
navigation.setParams({ allUsers });
} catch (error) {
console.log('TCL: fetchMembers -> error', error);
log('err_fetch_members, error');
this.setState({ isLoading: false });
}
}
@ -234,7 +234,7 @@ export default class RoomMembersView extends React.Component {
await RocketChat.toggleMuteUserInRoom(rid, userLongPressed.username, !userLongPressed.muted);
this.toast.show(I18n.t('User_has_been_key', { key: userLongPressed.muted ? I18n.t('unmuted') : I18n.t('muted') }));
} catch (e) {
log('handleMute', e);
log('err_handle_mute', e);
}
}

View File

@ -105,7 +105,7 @@ export class List extends React.PureComponent {
this.setState({ end: result.length < 50, loading: false });
} catch (e) {
this.setState({ loading: false });
log('ListView.onEndReached', e);
log('err_list_view_on_end_reached', e);
}
}, 300)

View File

@ -111,7 +111,7 @@ export default class UploadProgress extends Component {
try {
database.write(() => database.delete(uploadItem[0]));
} catch (e) {
log('UploadProgess.deleteUpload', e);
log('err_upload_progress_delete', e);
}
}
@ -119,7 +119,7 @@ export default class UploadProgress extends Component {
try {
await RocketChat.cancelUpload(item.path);
} catch (e) {
log('UploadProgess.cancelUpload', e);
log('err_upload_progress_cancel', e);
}
}
@ -132,7 +132,7 @@ export default class UploadProgress extends Component {
});
await RocketChat.sendFileMessage(rid, item);
} catch (e) {
log('UploadProgess.tryAgain', e);
log('err_upload_progress_try_again', e);
}
}

View File

@ -298,8 +298,7 @@ export default class RoomView extends React.Component {
}
});
} catch (e) {
console.log('TCL: init -> e', e);
log('RoomView.init', e);
log('err_room_init', e);
}
}
@ -325,7 +324,7 @@ export default class RoomView extends React.Component {
}
RocketChat.setReaction(shortname, messageId);
} catch (e) {
log('RoomView.onReactionPress', e);
log('err_room_on_reaction_press', e);
}
};
@ -420,8 +419,7 @@ export default class RoomView extends React.Component {
}
return Promise.resolve();
} catch (e) {
console.log('TCL: getMessages -> e', e);
log('getMessages', e);
log('err_get_messages', e);
}
}
@ -429,8 +427,7 @@ export default class RoomView extends React.Component {
try {
return RocketChat.loadThreadMessages({ tmid: this.tmid });
} catch (e) {
console.log('TCL: getThreadMessages -> e', e);
log('getThreadMessages', e);
log('err_get_thread_messages', e);
}
}
@ -445,7 +442,7 @@ export default class RoomView extends React.Component {
});
}
} catch (e) {
log('joinRoom', e);
log('err_join_room', e);
}
};
@ -486,7 +483,7 @@ export default class RoomView extends React.Component {
database.create('threads', buildMessage(EJSON.fromJSONValue(thread)), true);
});
} catch (error) {
console.log('TCL: fetchThreadName -> error', error);
log('err_fetch_thread_name', error);
}
}
@ -495,8 +492,7 @@ export default class RoomView extends React.Component {
await RocketChat.toggleFollowMessage(this.tmid, !isFollowingThread);
this.toast.show(isFollowingThread ? 'Unfollowed thread' : 'Following thread');
} catch (e) {
console.log('TCL: RightButtonsContainer -> toggleFollowThread -> e', e);
log('toggleFollowThread', e);
log('err_toggle_follow_thread', e);
}
}

View File

@ -63,7 +63,7 @@ export default class Sort extends PureComponent {
setSortPreference(param);
RocketChat.saveSortPreference(param);
} catch (e) {
log('RoomsListView.setSortPreference', e);
log('err_set_sort_preference', e);
}
}

View File

@ -360,7 +360,7 @@ export default class RoomsListView extends React.Component {
return this.goRoom({ rid: result.room._id, name: username, t: 'd' });
}
} catch (e) {
log('RoomsListView._onPressItem', e);
log('err_on_press_item', e);
}
} else {
return this.goRoom(item);

View File

@ -15,6 +15,7 @@ import Message from '../../containers/message/Message';
import scrollPersistTaps from '../../utils/scrollPersistTaps';
import I18n from '../../i18n';
import StatusBar from '../../containers/StatusBar';
import log from '../../utils/log';
@connect(state => ({
baseUrl: state.settings.Site_Url || state.server ? state.server.server : '',
@ -81,7 +82,7 @@ export default class SearchMessagesView extends React.Component {
}
} catch (error) {
this.setState({ loading: false });
console.log('SearchMessagesView -> search -> catch -> error', error);
log('err_search_messages', error);
}
}, 1000)

View File

@ -132,7 +132,7 @@ export default class SelectedUsersView extends React.Component {
await RocketChat.addUsersToRoom(rid);
navigation.pop();
} catch (e) {
log('RoomActions Add User', e);
log('err_add_user', e);
} finally {
setLoadingInvite(false);
}

View File

@ -16,6 +16,7 @@ import scrollPersistTaps from '../utils/scrollPersistTaps';
import I18n from '../i18n';
import RocketChat from '../lib/rocketchat';
import StatusBar from '../containers/StatusBar';
import log from '../utils/log';
const styles = StyleSheet.create({
loginTitle: {
@ -97,7 +98,7 @@ export default class SetUsernameView extends React.Component {
await RocketChat.setUsername(username);
await loginRequest({ resume: token });
} catch (e) {
console.log('SetUsernameView -> catch -> e', e);
log('err_submit_username', e);
}
this.setState({ saving: false });
}

View File

@ -162,7 +162,7 @@ export default class SettingsView extends React.Component {
this.setState({ saving: false });
setTimeout(() => {
showErrorAlert(I18n.t('There_was_an_error_while_action', { action: I18n.t('saving_preferences') }));
log('saveUserPreferences', e);
log('err_save_user_preferences', e);
}, 300);
}
}

View File

@ -172,7 +172,7 @@ export default class Sidebar extends Component {
try {
RocketChat.setUserPresenceDefaultStatus(item.id);
} catch (e) {
log('setUserPresenceDefaultStatus', e);
log('err_set_user_presence_default_status', e);
}
}
}}

View File

@ -115,7 +115,7 @@ export default class ThreadMessagesView extends React.Component {
try {
database.create('threads', buildMessage(message), true);
} catch (e) {
log('ThreadMessagesView -> load -> create', e);
log('err_thread_messages_create', e);
}
}));
@ -126,7 +126,7 @@ export default class ThreadMessagesView extends React.Component {
});
}
} catch (error) {
console.log('ThreadMessagesView -> load -> error', error);
log('err_thread_messages_load', error);
this.setState({ loading: false, end: true });
}
}, 300)
@ -148,7 +148,7 @@ export default class ThreadMessagesView extends React.Component {
try {
database.create('threads', buildMessage(message), true);
} catch (e) {
log('ThreadMessagesView -> sync -> update', e);
log('err_thread_messages_update', e);
}
});
}
@ -160,7 +160,7 @@ export default class ThreadMessagesView extends React.Component {
try {
database.delete(oldMessage);
} catch (e) {
log('ThreadMessagesView -> sync -> delete', e);
log('err_thread_messages_delete', e);
}
}
});
@ -173,7 +173,7 @@ export default class ThreadMessagesView extends React.Component {
});
}
} catch (error) {
console.log('ThreadMessagesView -> sync -> error', error);
log('err_thread_messages_sync', error);
this.setState({ loading: false });
}
}

View File

@ -99,6 +99,16 @@
ReferencedContainer = "container:RocketChatRN.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-FIRDebugDisabled"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "-FIRDebugEnabled"
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"