1
0
Fork 0

Return next to send a 500 status code

This commit is contained in:
Chocobozzz 2015-10-30 17:51:40 +01:00
parent dd0f21d1ea
commit e63dc45fa3
3 changed files with 10 additions and 10 deletions

View file

@ -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)
})

View file

@ -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)
})

View file

@ -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)
})