From e63dc45fa368de478ba3b37eabbfb1c233988348 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 30 Oct 2015 17:51:40 +0100 Subject: [PATCH] Return next to send a 500 status code --- routes/api/pods.js | 6 +++--- routes/api/remoteVideos.js | 4 ++-- 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 @@ function listPods (req, res, next) { pods.list(function (err, pods_list) { - if (err) next(err) + if (err) return next(err) res.json(pods_list) }) @@ -16,7 +16,7 @@ function addPods (req, res, next) { pods.add(req.body.data, function (err, json) { - if (err) next(err) + if (err) return next(err) res.json(json) }) @@ -24,7 +24,7 @@ function makeFriends (req, res, next) { pods.makeFriends(function (err) { - if (err) next(err) + if (err) return next(err) res.sendStatus(204) }) 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 @@ function addRemoteVideos (req, res, next) { videos.addRemote(req.body.data, function (err, video) { - if (err) next(err) + if (err) return next(err) res.json(video) }) @@ -16,7 +16,7 @@ function removeRemoteVideo (req, res, next) { videos.removeRemote(req.body.signature.url, req.body.data.magnetUri, function (err) { - if (err) next(err) + if (err) return next(err) res.status(204) }) 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) }) -- 2.41.0