From 8425cb894d4867d26fd5f7fae7862b0669f3c717 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 Feb 2016 19:02:05 +0100 Subject: Error handling mini refractoring --- controllers/api/v1/pods.js | 7 ++++--- controllers/api/v1/videos.js | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'controllers/api') diff --git a/controllers/api/v1/pods.js b/controllers/api/v1/pods.js index 29517ba8e..456f53dea 100644 --- a/controllers/api/v1/pods.js +++ b/controllers/api/v1/pods.js @@ -39,13 +39,13 @@ fs.readFile(peertubeCrypto.getCertDir() + 'peertube.pub', 'utf8', function (err, cert) { if (err) { - logger.error('Cannot read cert file.', { error: err }) + logger.error('Cannot read cert file.') return next(err) } Videos.listOwned(function (err, videos_list) { if (err) { - logger.error('Cannot get the list of owned videos.', { error: err }) + logger.error('Cannot get the list of owned videos.') return next(err) } @@ -78,7 +78,8 @@ Videos.removeAllRemotesOf(url, function (err) { if (err) logger.error('Cannot remove all remote videos of %s.', url) - logger.info('%s pod removed.', url) + else logger.info('%s pod removed.', url) + res.sendStatus(204) }) }) diff --git a/controllers/api/v1/videos.js b/controllers/api/v1/videos.js index 7792059ca..eec95c801 100644 --- a/controllers/api/v1/videos.js +++ b/controllers/api/v1/videos.js @@ -56,7 +56,7 @@ videos.seed(video_file.path, function (err, torrent) { if (err) { - logger.error('Cannot seed this video.', { error: err }) + logger.error('Cannot seed this video.') return next(err) } @@ -70,7 +70,7 @@ Videos.add(video_data, function (err) { if (err) { // TODO unseed the video - logger.error('Cannot insert this video in the database.', { error: err }) + logger.error('Cannot insert this video in the database.') return next(err) } -- cgit v1.2.3