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 | |
parent | dd0f21d1ea54389727fbf7e6333dd2585e1613d5 (diff) | |
download | PeerTube-e63dc45fa368de478ba3b37eabbfb1c233988348.tar.gz PeerTube-e63dc45fa368de478ba3b37eabbfb1c233988348.tar.zst PeerTube-e63dc45fa368de478ba3b37eabbfb1c233988348.zip |
Return next to send a 500 status code
-rw-r--r-- | routes/api/pods.js | 6 | ||||
-rw-r--r-- | routes/api/remoteVideos.js | 4 | ||||
-rw-r--r-- | routes/api/videos.js | 10 |
3 files changed, 10 insertions, 10 deletions
diff --git a/routes/api/pods.js b/routes/api/pods.js index 3f9e85052..8fa29b4f7 100644 --- a/routes/api/pods.js +++ b/routes/api/pods.js | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | function listPods (req, res, next) { | 9 | function listPods (req, res, next) { |
10 | pods.list(function (err, pods_list) { | 10 | pods.list(function (err, pods_list) { |
11 | if (err) next(err) | 11 | if (err) return next(err) |
12 | 12 | ||
13 | res.json(pods_list) | 13 | res.json(pods_list) |
14 | }) | 14 | }) |
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | function addPods (req, res, next) { | 17 | function addPods (req, res, next) { |
18 | pods.add(req.body.data, function (err, json) { | 18 | pods.add(req.body.data, function (err, json) { |
19 | if (err) next(err) | 19 | if (err) return next(err) |
20 | 20 | ||
21 | res.json(json) | 21 | res.json(json) |
22 | }) | 22 | }) |
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | function makeFriends (req, res, next) { | 25 | function makeFriends (req, res, next) { |
26 | pods.makeFriends(function (err) { | 26 | pods.makeFriends(function (err) { |
27 | if (err) next(err) | 27 | if (err) return next(err) |
28 | 28 | ||
29 | res.sendStatus(204) | 29 | res.sendStatus(204) |
30 | }) | 30 | }) |
diff --git a/routes/api/remoteVideos.js b/routes/api/remoteVideos.js index eed586d23..2ae3ce5bc 100644 --- a/routes/api/remoteVideos.js +++ b/routes/api/remoteVideos.js | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | function addRemoteVideos (req, res, next) { | 9 | function addRemoteVideos (req, res, next) { |
10 | videos.addRemote(req.body.data, function (err, video) { | 10 | videos.addRemote(req.body.data, function (err, video) { |
11 | if (err) next(err) | 11 | if (err) return next(err) |
12 | 12 | ||
13 | res.json(video) | 13 | res.json(video) |
14 | }) | 14 | }) |
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | function removeRemoteVideo (req, res, next) { | 17 | function removeRemoteVideo (req, res, next) { |
18 | videos.removeRemote(req.body.signature.url, req.body.data.magnetUri, function (err) { | 18 | videos.removeRemote(req.body.signature.url, req.body.data.magnetUri, function (err) { |
19 | if (err) next(err) | 19 | if (err) return next(err) |
20 | 20 | ||
21 | res.status(204) | 21 | res.status(204) |
22 | }) | 22 | }) |
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 | }) |