Browse Source

analytics: don't initialize handlers if they are not properly configured

master
Saúl Ibarra Corretgé 6 years ago
parent
commit
6bbc2927ab

+ 1
- 6
react/features/analytics/handlers/AmplitudeHandler.js View File

1
 import AbstractHandler from './AbstractHandler';
1
 import AbstractHandler from './AbstractHandler';
2
 import { amplitude } from './amplitude';
2
 import { amplitude } from './amplitude';
3
 
3
 
4
-const logger = require('jitsi-meet-logger').getLogger(__filename);
5
-
6
 /**
4
 /**
7
  * Analytics handler for Amplitude.
5
  * Analytics handler for Amplitude.
8
  */
6
  */
20
         const { amplitudeAPPKey, host } = options;
18
         const { amplitudeAPPKey, host } = options;
21
 
19
 
22
         if (!amplitudeAPPKey) {
20
         if (!amplitudeAPPKey) {
23
-            logger.warn(
24
-                'Failed to initialize Amplitude handler, no APP key');
25
-
26
-            return;
21
+            throw new Error('Failed to initialize Amplitude handler, no APP key');
27
         }
22
         }
28
 
23
 
29
         this._enabled = true;
24
         this._enabled = true;

+ 1
- 7
react/features/analytics/handlers/GoogleAnalyticsHandler.js View File

4
 
4
 
5
 import AbstractHandler from './AbstractHandler';
5
 import AbstractHandler from './AbstractHandler';
6
 
6
 
7
-const logger = require('jitsi-meet-logger').getLogger(__filename);
8
-
9
 /**
7
 /**
10
  * Analytics handler for Google Analytics.
8
  * Analytics handler for Google Analytics.
11
  */
9
  */
24
         this._userProperties = {};
22
         this._userProperties = {};
25
 
23
 
26
         if (!options.googleAnalyticsTrackingId) {
24
         if (!options.googleAnalyticsTrackingId) {
27
-            logger.warn(
28
-                'Failed to initialize Google Analytics handler, no tracking ID'
29
-            );
30
-
31
-            return;
25
+            throw new Error('Failed to initialize Google Analytics handler, no tracking ID');
32
         }
26
         }
33
 
27
 
34
         this._enabled = true;
28
         this._enabled = true;

Loading…
Cancel
Save