[IMPROVEMENT] Log server version (#1786)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
9d615d5ffb
commit
ea4f3797ff
|
@ -15,7 +15,7 @@ import {
|
||||||
import { setUser } from '../actions/login';
|
import { setUser } from '../actions/login';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
import database from '../lib/database';
|
import database from '../lib/database';
|
||||||
import log from '../utils/log';
|
import log, { logServerVersion } from '../utils/log';
|
||||||
import { extractHostname } from '../utils/server';
|
import { extractHostname } from '../utils/server';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import { SERVERS, TOKEN, SERVER_URL } from '../constants/userDefaults';
|
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
|
// 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) {
|
} catch (e) {
|
||||||
yield put(selectServerFailure());
|
yield put(selectServerFailure());
|
||||||
log(e);
|
log(e);
|
||||||
|
|
|
@ -8,9 +8,23 @@ export const { analytics } = firebase;
|
||||||
export const loggerConfig = bugsnag.config;
|
export const loggerConfig = bugsnag.config;
|
||||||
export const { leaveBreadcrumb } = bugsnag;
|
export const { leaveBreadcrumb } = bugsnag;
|
||||||
|
|
||||||
|
let metadata = {};
|
||||||
|
|
||||||
|
export const logServerVersion = (serverVersion) => {
|
||||||
|
metadata = {
|
||||||
|
serverVersion
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export default (e) => {
|
export default (e) => {
|
||||||
if (e instanceof Error && !__DEV__) {
|
if (e instanceof Error && !__DEV__) {
|
||||||
bugsnag.notify(e);
|
bugsnag.notify(e, (report) => {
|
||||||
|
report.metadata = {
|
||||||
|
details: {
|
||||||
|
...metadata
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue