diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-06-01 01:36:53 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-02 16:57:07 +0200 |
commit | 76148b27f7501bac061992136852be4303370c8d (patch) | |
tree | fc0559253e833c9252fa14ebaec5321d88bfb4e8 /server/controllers/api/videos/upload.ts | |
parent | 5ed25fb76e920dac364cb9ef46f14ec4bd372949 (diff) | |
download | PeerTube-76148b27f7501bac061992136852be4303370c8d.tar.gz PeerTube-76148b27f7501bac061992136852be4303370c8d.tar.zst PeerTube-76148b27f7501bac061992136852be4303370c8d.zip |
refactor API errors to standard error format
Diffstat (limited to 'server/controllers/api/videos/upload.ts')
-rw-r--r-- | server/controllers/api/videos/upload.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts index ebc17c760..c33d7fcb9 100644 --- a/server/controllers/api/videos/upload.ts +++ b/server/controllers/api/videos/upload.ts | |||
@@ -97,8 +97,11 @@ export async function addVideoLegacy (req: express.Request, res: express.Respons | |||
97 | // Uploading the video could be long | 97 | // Uploading the video could be long |
98 | // Set timeout to 10 minutes, as Express's default is 2 minutes | 98 | // Set timeout to 10 minutes, as Express's default is 2 minutes |
99 | req.setTimeout(1000 * 60 * 10, () => { | 99 | req.setTimeout(1000 * 60 * 10, () => { |
100 | logger.error('Upload video has timed out.') | 100 | logger.error('Video upload has timed out.') |
101 | return res.sendStatus(HttpStatusCode.REQUEST_TIMEOUT_408) | 101 | return res.fail({ |
102 | status: HttpStatusCode.REQUEST_TIMEOUT_408, | ||
103 | message: 'Video upload has timed out.' | ||
104 | }) | ||
102 | }) | 105 | }) |
103 | 106 | ||
104 | const videoPhysicalFile = req.files['videofile'][0] | 107 | const videoPhysicalFile = req.files['videofile'][0] |