]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/shared/metrics/metrics-plugin.ts
Catch metrics error
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / shared / metrics / metrics-plugin.ts
index 0e296bef6f967da8d190665d06c3b4210e08c672..2aae3e90a51bfabb0e757bf1134384af4d40427d 100644 (file)
@@ -1,6 +1,7 @@
 import videojs from 'video.js'
 import { PlaybackMetricCreate } from '../../../../../../shared/models'
 import { MetricsPluginOptions, PlayerMode, PlayerNetworkInfo } from '../../types'
+import { logger } from '@root-helpers/logger'
 
 const Plugin = videojs.getPlugin('plugin')
 
@@ -99,6 +100,7 @@ class MetricsPlugin extends Plugin {
       const headers = new Headers({ 'Content-type': 'application/json; charset=UTF-8' })
 
       return fetch(this.metricsUrl, { method: 'POST', body: JSON.stringify(body), headers })
+        .catch(err => logger.error('Cannot send metrics to the server.', err))
     }, this.CONSTANTS.METRICS_INTERVAL)
   }