From e63dc45fa368de478ba3b37eabbfb1c233988348 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 30 Oct 2015 17:51:40 +0100 Subject: Return next to send a 500 status code --- routes/api/videos.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'routes/api/videos.js') diff --git a/routes/api/videos.js b/routes/api/videos.js index c38d6d42c..087fc96bc 100644 --- a/routes/api/videos.js +++ b/routes/api/videos.js @@ -8,7 +8,7 @@ function listVideos (req, res, next) { videos.list(function (err, videos_list) { - if (err) next(err) + if (err) return next(err) res.json(videos_list) }) @@ -16,7 +16,7 @@ function searchVideos (req, res, next) { videos.search(req.params.name, function (err, videos_list) { - if (err) next(err) + if (err) return next(err) res.json(videos_list) }) @@ -24,7 +24,7 @@ function addVideos (req, res, next) { videos.add({ video: req.files.input_video, data: req.body }, function (err) { - if (err) next(err) + if (err) return next(err) // TODO : include Location of the new video res.sendStatus(201) @@ -33,7 +33,7 @@ function getVideos (req, res, next) { videos.get(req.params.id, function (err, video) { - if (err) next(err) + if (err) return next(err) if (video === null) { return res.sendStatus(404) @@ -45,7 +45,7 @@ function removeVideo (req, res, next) { videos.remove(req.params.id, function (err) { - if (err) next(err) + if (err) return next(err) res.sendStatus(204) }) -- cgit v1.2.3