aboutsummaryrefslogtreecommitdiffhomepage
path: root/controllers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-02-05 19:02:05 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-02-05 19:02:05 +0100
commit8425cb894d4867d26fd5f7fae7862b0669f3c717 (patch)
tree5e2f00a8219e198f2dd074ca13f3ae681174228f /controllers
parentdac0a5319ab1c52a0958647b1593f85339b77e29 (diff)
downloadPeerTube-8425cb894d4867d26fd5f7fae7862b0669f3c717.tar.gz
PeerTube-8425cb894d4867d26fd5f7fae7862b0669f3c717.tar.zst
PeerTube-8425cb894d4867d26fd5f7fae7862b0669f3c717.zip
Error handling mini refractoring
Diffstat (limited to 'controllers')
-rw-r--r--controllers/api/v1/pods.js7
-rw-r--r--controllers/api/v1/videos.js4
2 files changed, 6 insertions, 5 deletions
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 @@
39 39
40 fs.readFile(peertubeCrypto.getCertDir() + 'peertube.pub', 'utf8', function (err, cert) { 40 fs.readFile(peertubeCrypto.getCertDir() + 'peertube.pub', 'utf8', function (err, cert) {
41 if (err) { 41 if (err) {
42 logger.error('Cannot read cert file.', { error: err }) 42 logger.error('Cannot read cert file.')
43 return next(err) 43 return next(err)
44 } 44 }
45 45
46 Videos.listOwned(function (err, videos_list) { 46 Videos.listOwned(function (err, videos_list) {
47 if (err) { 47 if (err) {
48 logger.error('Cannot get the list of owned videos.', { error: err }) 48 logger.error('Cannot get the list of owned videos.')
49 return next(err) 49 return next(err)
50 } 50 }
51 51
@@ -78,7 +78,8 @@
78 78
79 Videos.removeAllRemotesOf(url, function (err) { 79 Videos.removeAllRemotesOf(url, function (err) {
80 if (err) logger.error('Cannot remove all remote videos of %s.', url) 80 if (err) logger.error('Cannot remove all remote videos of %s.', url)
81 logger.info('%s pod removed.', url) 81 else logger.info('%s pod removed.', url)
82
82 res.sendStatus(204) 83 res.sendStatus(204)
83 }) 84 })
84 }) 85 })
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 @@
56 56
57 videos.seed(video_file.path, function (err, torrent) { 57 videos.seed(video_file.path, function (err, torrent) {
58 if (err) { 58 if (err) {
59 logger.error('Cannot seed this video.', { error: err }) 59 logger.error('Cannot seed this video.')
60 return next(err) 60 return next(err)
61 } 61 }
62 62
@@ -70,7 +70,7 @@
70 Videos.add(video_data, function (err) { 70 Videos.add(video_data, function (err) {
71 if (err) { 71 if (err) {
72 // TODO unseed the video 72 // TODO unseed the video
73 logger.error('Cannot insert this video in the database.', { error: err }) 73 logger.error('Cannot insert this video in the database.')
74 return next(err) 74 return next(err)
75 } 75 }
76 76