diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2015-10-30 17:51:40 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2015-10-30 17:51:40 +0100 |
commit | e63dc45fa368de478ba3b37eabbfb1c233988348 (patch) | |
tree | 1bdf706ff9a37bfd159ed4280bb336e4d46e6725 /routes/api/videos.js | |
parent | dd0f21d1ea54389727fbf7e6333dd2585e1613d5 (diff) | |
download | PeerTube-e63dc45fa368de478ba3b37eabbfb1c233988348.tar.gz PeerTube-e63dc45fa368de478ba3b37eabbfb1c233988348.tar.zst PeerTube-e63dc45fa368de478ba3b37eabbfb1c233988348.zip |
Return next to send a 500 status code
Diffstat (limited to 'routes/api/videos.js')
-rw-r--r-- | routes/api/videos.js | 10 |
1 files changed, 5 insertions, 5 deletions
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 @@ | |||
8 | 8 | ||
9 | function listVideos (req, res, next) { | 9 | function listVideos (req, res, next) { |
10 | videos.list(function (err, videos_list) { | 10 | videos.list(function (err, videos_list) { |
11 | if (err) next(err) | 11 | if (err) return next(err) |
12 | 12 | ||
13 | res.json(videos_list) | 13 | res.json(videos_list) |
14 | }) | 14 | }) |
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | function searchVideos (req, res, next) { | 17 | function searchVideos (req, res, next) { |
18 | videos.search(req.params.name, function (err, videos_list) { | 18 | videos.search(req.params.name, function (err, videos_list) { |
19 | if (err) next(err) | 19 | if (err) return next(err) |
20 | 20 | ||
21 | res.json(videos_list) | 21 | res.json(videos_list) |
22 | }) | 22 | }) |
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | function addVideos (req, res, next) { | 25 | function addVideos (req, res, next) { |
26 | videos.add({ video: req.files.input_video, data: req.body }, function (err) { | 26 | videos.add({ video: req.files.input_video, data: req.body }, function (err) { |
27 | if (err) next(err) | 27 | if (err) return next(err) |
28 | 28 | ||
29 | // TODO : include Location of the new video | 29 | // TODO : include Location of the new video |
30 | res.sendStatus(201) | 30 | res.sendStatus(201) |
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | function getVideos (req, res, next) { | 34 | function getVideos (req, res, next) { |
35 | videos.get(req.params.id, function (err, video) { | 35 | videos.get(req.params.id, function (err, video) { |
36 | if (err) next(err) | 36 | if (err) return next(err) |
37 | 37 | ||
38 | if (video === null) { | 38 | if (video === null) { |
39 | return res.sendStatus(404) | 39 | return res.sendStatus(404) |
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | function removeVideo (req, res, next) { | 46 | function removeVideo (req, res, next) { |
47 | videos.remove(req.params.id, function (err) { | 47 | videos.remove(req.params.id, function (err) { |
48 | if (err) next(err) | 48 | if (err) return next(err) |
49 | 49 | ||
50 | res.sendStatus(204) | 50 | res.sendStatus(204) |
51 | }) | 51 | }) |