Unverified Commit ea4f3797 authored by Djorkaeff Alexandre's avatar Djorkaeff Alexandre Committed by GitHub
Browse files

[IMPROVEMENT] Log server version (#1786)


Co-authored-by: default avatarDiego Mello <diegolmello@gmail.com>
parent 9d615d5f
......@@ -15,7 +15,7 @@ import {
import { setUser } from '../actions/login';
import RocketChat from '../lib/rocketchat';
import database from '../lib/database';
import log from '../utils/log';
import log, { logServerVersion } from '../utils/log';
import { extractHostname } from '../utils/server';
import I18n from '../i18n';
import { SERVERS, TOKEN, SERVER_URL } from '../constants/userDefaults';
......@@ -113,7 +113,11 @@ const handleSelectServer = function* handleSelectServer({ server, version, fetch
}
// Return server version even when offline
yield put(selectServerSuccess(server, (serverInfo && serverInfo.version) || version));
const serverVersion = (serverInfo && serverInfo.version) || version;
// we'll set serverVersion as metadata for bugsnag
logServerVersion(serverVersion);
yield put(selectServerSuccess(server, serverVersion));
} catch (e) {
yield put(selectServerFailure());
log(e);
......
......@@ -8,9 +8,23 @@ export const { analytics } = firebase;
export const loggerConfig = bugsnag.config;
export const { leaveBreadcrumb } = bugsnag;
let metadata = {};
export const logServerVersion = (serverVersion) => {
metadata = {
serverVersion
};
};
export default (e) => {
if (e instanceof Error && !__DEV__) {
bugsnag.notify(e);
bugsnag.notify(e, (report) => {
report.metadata = {
details: {
...metadata
}
};
});
} else {
console.log(e);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment