From 76148b27f7501bac061992136852be4303370c8d Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 1 Jun 2021 01:36:53 +0200 Subject: refactor API errors to standard error format --- server/helpers/middlewares/video-captions.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'server/helpers/middlewares/video-captions.ts') diff --git a/server/helpers/middlewares/video-captions.ts b/server/helpers/middlewares/video-captions.ts index 226d3c5f8..2a12c4813 100644 --- a/server/helpers/middlewares/video-captions.ts +++ b/server/helpers/middlewares/video-captions.ts @@ -7,9 +7,10 @@ async function doesVideoCaptionExist (video: MVideoId, language: string, res: Re const videoCaption = await VideoCaptionModel.loadByVideoIdAndLanguage(video.id, language) if (!videoCaption) { - res.status(HttpStatusCode.NOT_FOUND_404) - .json({ error: 'Video caption not found' }) - + res.fail({ + status: HttpStatusCode.NOT_FOUND_404, + message: 'Video caption not found' + }) return false } -- cgit v1.2.3