aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/files-cache/videos-caption-cache.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-30 09:25:17 +0200
committerChocobozzz <me@florianbigard.com>2022-06-30 09:25:17 +0200
commitcd25344f741e8c97b113b36eb6babc7be490114d (patch)
tree83742ef011ea3ea66cba7fefbafa593614215e22 /server/lib/files-cache/videos-caption-cache.ts
parenta4152bed14427ef91f69e11d1a2cd9745aa74408 (diff)
downloadPeerTube-cd25344f741e8c97b113b36eb6babc7be490114d.tar.gz
PeerTube-cd25344f741e8c97b113b36eb6babc7be490114d.tar.zst
PeerTube-cd25344f741e8c97b113b36eb6babc7be490114d.zip
Reduce lazy static error logs
Diffstat (limited to 'server/lib/files-cache/videos-caption-cache.ts')
-rw-r--r--server/lib/files-cache/videos-caption-cache.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/server/lib/files-cache/videos-caption-cache.ts b/server/lib/files-cache/videos-caption-cache.ts
index 2927c37eb..d21acf4ef 100644
--- a/server/lib/files-cache/videos-caption-cache.ts
+++ b/server/lib/files-cache/videos-caption-cache.ts
@@ -1,4 +1,5 @@
1import { join } from 'path' 1import { join } from 'path'
2import { logger } from '@server/helpers/logger'
2import { doRequestAndSaveToFile } from '@server/helpers/requests' 3import { doRequestAndSaveToFile } from '@server/helpers/requests'
3import { CONFIG } from '../../initializers/config' 4import { CONFIG } from '../../initializers/config'
4import { FILES_CACHE } from '../../initializers/constants' 5import { FILES_CACHE } from '../../initializers/constants'
@@ -41,9 +42,15 @@ class VideosCaptionCache extends AbstractVideoStaticFileCache <string> {
41 const remoteUrl = videoCaption.getFileUrl(video) 42 const remoteUrl = videoCaption.getFileUrl(video)
42 const destPath = join(FILES_CACHE.VIDEO_CAPTIONS.DIRECTORY, videoCaption.filename) 43 const destPath = join(FILES_CACHE.VIDEO_CAPTIONS.DIRECTORY, videoCaption.filename)
43 44
44 await doRequestAndSaveToFile(remoteUrl, destPath) 45 try {
46 await doRequestAndSaveToFile(remoteUrl, destPath)
45 47
46 return { isOwned: false, path: destPath } 48 return { isOwned: false, path: destPath }
49 } catch (err) {
50 logger.info('Cannot fetch remote caption file %s.', remoteUrl, { err })
51
52 return undefined
53 }
47 } 54 }
48} 55}
49 56