1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-12 17:26:17 +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
mobileAnalyticsClient.recordEvent(type) try {
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
mobileAnalyticsClient.recordEvent('UI_COLOR_THEME', { try {
uiColorTheme: ConfigManager.default.get().ui.theme mobileAnalyticsClient.recordEvent('UI_COLOR_THEME', {
}) uiColorTheme: ConfigManager.default.get().ui.theme
})
} catch (analyticsError) {
if (analyticsError instanceof ReferenceError) {
console.log(analyticsError.name + ': ' + analyticsError.message)
}
}
} }
module.exports = { module.exports = {