@mongodb-js/compass-logging
Advanced tools
Comparing version 0.0.0-next-e30a9e850a8a66b70770fbf6658a3e35cf1ff8b8 to 0.0.0-next-e3d7e58db726184c34e0d2d9f3342595a865eb55
@@ -33,3 +33,3 @@ "use strict"; | ||
const debug_1 = __importDefault(require("debug")); | ||
let preferencesIpc; | ||
let preferences; | ||
function emit(ipc, event, data) { | ||
@@ -63,13 +63,13 @@ var _a; | ||
try { | ||
preferencesIpc !== null && preferencesIpc !== void 0 ? preferencesIpc : (preferencesIpc = (await Promise.resolve().then(() => __importStar(require('compass-preferences-model')))) | ||
.preferencesIpc); | ||
preferences !== null && preferences !== void 0 ? preferences : (preferences = (await Promise.resolve().then(() => __importStar(require('compass-preferences-model')))) | ||
.preferencesAccess); | ||
} | ||
catch (_a) { | ||
preferencesIpc !== null && preferencesIpc !== void 0 ? preferencesIpc : (preferencesIpc = { | ||
preferences !== null && preferences !== void 0 ? preferences : (preferences = { | ||
getPreferences() { | ||
return Promise.resolve({ trackUsageStatistics: true }); | ||
return { trackUsageStatistics: true }; | ||
}, | ||
}); | ||
} | ||
const { trackUsageStatistics = true } = await (preferencesIpc === null || preferencesIpc === void 0 ? void 0 : preferencesIpc.getPreferences()); | ||
const { trackUsageStatistics = true } = preferences === null || preferences === void 0 ? void 0 : preferences.getPreferences(); | ||
if (!trackUsageStatistics) { | ||
@@ -83,3 +83,14 @@ return; | ||
if (typeof properties === 'function') { | ||
data.properties = await properties(); | ||
try { | ||
data.properties = await properties(); | ||
} | ||
catch (error) { | ||
emit(ipc, 'compass:track', { | ||
event: 'Error Fetching Attributes', | ||
properties: { | ||
event_name: event, | ||
}, | ||
}); | ||
return; | ||
} | ||
} | ||
@@ -86,0 +97,0 @@ emit(ipc, 'compass:track', data); |
@@ -16,3 +16,3 @@ { | ||
"homepage": "https://github.com/mongodb-js/compass", | ||
"version": "0.0.0-next-e30a9e850a8a66b70770fbf6658a3e35cf1ff8b8", | ||
"version": "0.0.0-next-e3d7e58db726184c34e0d2d9f3342595a865eb55", | ||
"repository": { | ||
@@ -57,6 +57,6 @@ "type": "git", | ||
"devDependencies": { | ||
"@mongodb-js/eslint-config-compass": "0.0.0-next-e30a9e850a8a66b70770fbf6658a3e35cf1ff8b8", | ||
"@mongodb-js/mocha-config-compass": "0.0.0-next-e30a9e850a8a66b70770fbf6658a3e35cf1ff8b8", | ||
"@mongodb-js/prettier-config-compass": "0.0.0-next-e30a9e850a8a66b70770fbf6658a3e35cf1ff8b8", | ||
"@mongodb-js/tsconfig-compass": "0.0.0-next-e30a9e850a8a66b70770fbf6658a3e35cf1ff8b8", | ||
"@mongodb-js/eslint-config-compass": "0.0.0-next-e3d7e58db726184c34e0d2d9f3342595a865eb55", | ||
"@mongodb-js/mocha-config-compass": "0.0.0-next-e3d7e58db726184c34e0d2d9f3342595a865eb55", | ||
"@mongodb-js/prettier-config-compass": "0.0.0-next-e3d7e58db726184c34e0d2d9f3342595a865eb55", | ||
"@mongodb-js/tsconfig-compass": "0.0.0-next-e3d7e58db726184c34e0d2d9f3342595a865eb55", | ||
"@types/chai": "^4.2.21", | ||
@@ -68,3 +68,3 @@ "@types/mocha": "^9.0.0", | ||
"eslint": "^7.25.0", | ||
"hadron-ipc": "0.0.0-next-e30a9e850a8a66b70770fbf6658a3e35cf1ff8b8", | ||
"hadron-ipc": "0.0.0-next-e3d7e58db726184c34e0d2d9f3342595a865eb55", | ||
"mocha": "^8.4.0", | ||
@@ -79,3 +79,3 @@ "nyc": "^15.1.0", | ||
}, | ||
"gitHead": "e30a9e850a8a66b70770fbf6658a3e35cf1ff8b8" | ||
"gitHead": "e3d7e58db726184c34e0d2d9f3342595a865eb55" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
41007
124