1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-15 02:36:36 +00:00

Merge pull request #950 from clone1612/catchAnalyticsError

Add try/catch logic to recording of analytics events
This commit is contained in:
SuenagaRyota
2017-10-16 14:06:49 +09:00
committed by GitHub

View File

@@ -26,14 +26,26 @@ function initAwsMobileAnalytics () {
function recordDynamicCustomEvent (type) { function recordDynamicCustomEvent (type) {
if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return
try {
mobileAnalyticsClient.recordEvent(type) mobileAnalyticsClient.recordEvent(type)
} catch (analyticsError) {
if (analyticsError instanceof ReferenceError) {
console.log(analyticsError.name + ': ' + analyticsError.message)
}
}
} }
function recordStaticCustomEvent () { function recordStaticCustomEvent () {
if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return
try {
mobileAnalyticsClient.recordEvent('UI_COLOR_THEME', { mobileAnalyticsClient.recordEvent('UI_COLOR_THEME', {
uiColorTheme: ConfigManager.default.get().ui.theme uiColorTheme: ConfigManager.default.get().ui.theme
}) })
} catch (analyticsError) {
if (analyticsError instanceof ReferenceError) {
console.log(analyticsError.name + ': ' + analyticsError.message)
}
}
} }
module.exports = { module.exports = {