diff options
Diffstat (limited to 'models/videos.js')
-rw-r--r-- | models/videos.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/models/videos.js b/models/videos.js index 10abee6e7..6ea628373 100644 --- a/models/videos.js +++ b/models/videos.js | |||
@@ -50,7 +50,7 @@ | |||
50 | 50 | ||
51 | VideosDB.create(params, function (err, video) { | 51 | VideosDB.create(params, function (err, video) { |
52 | if (err) { | 52 | if (err) { |
53 | logger.error('Cannot insert this video into database.', { error: err }) | 53 | logger.error('Cannot insert this video into database.') |
54 | return callback(err) | 54 | return callback(err) |
55 | } | 55 | } |
56 | 56 | ||
@@ -82,7 +82,7 @@ | |||
82 | }, function () { | 82 | }, function () { |
83 | VideosDB.create(to_add, function (err, videos) { | 83 | VideosDB.create(to_add, function (err, videos) { |
84 | if (err) { | 84 | if (err) { |
85 | logger.error('Cannot insert this remote video.', { error: err }) | 85 | logger.error('Cannot insert this remote video.') |
86 | return callback(err) | 86 | return callback(err) |
87 | } | 87 | } |
88 | 88 | ||
@@ -94,7 +94,7 @@ | |||
94 | function get (id, callback) { | 94 | function get (id, callback) { |
95 | VideosDB.findById(id, function (err, video) { | 95 | VideosDB.findById(id, function (err, video) { |
96 | if (err) { | 96 | if (err) { |
97 | logger.error('Cannot get this video.', { error: err }) | 97 | logger.error('Cannot get this video.') |
98 | return callback(err) | 98 | return callback(err) |
99 | } | 99 | } |
100 | 100 | ||
@@ -120,14 +120,14 @@ | |||
120 | VideosDB.findById(id, function (err, video) { | 120 | VideosDB.findById(id, function (err, video) { |
121 | if (err || !video) { | 121 | if (err || !video) { |
122 | if (!err) err = new Error('Cannot find this video.') | 122 | if (!err) err = new Error('Cannot find this video.') |
123 | logger.error('Cannot find this video.', { error: err }) | 123 | logger.error('Cannot find this video.') |
124 | return callback(err) | 124 | return callback(err) |
125 | } | 125 | } |
126 | 126 | ||
127 | if (video.namePath === null) { | 127 | if (video.namePath === null) { |
128 | var error_string = 'Cannot remove the video of another pod.' | 128 | var error_string = 'Cannot remove the video of another pod.' |
129 | logger.error(error_string) | 129 | logger.error(error_string) |
130 | return callback(null, false, video) | 130 | return callback(new Error(error_string), false, video) |
131 | } | 131 | } |
132 | 132 | ||
133 | callback(null, true, video) | 133 | callback(null, true, video) |
@@ -137,7 +137,7 @@ | |||
137 | function list (callback) { | 137 | function list (callback) { |
138 | VideosDB.find(function (err, videos_list) { | 138 | VideosDB.find(function (err, videos_list) { |
139 | if (err) { | 139 | if (err) { |
140 | logger.error('Cannot get list of the videos.', { error: err }) | 140 | logger.error('Cannot get the list of the videos.') |
141 | return callback(err) | 141 | return callback(err) |
142 | } | 142 | } |
143 | 143 | ||
@@ -149,7 +149,7 @@ | |||
149 | // If namePath is not null this is *our* video | 149 | // If namePath is not null this is *our* video |
150 | VideosDB.find({ namePath: { $ne: null } }, function (err, videos_list) { | 150 | VideosDB.find({ namePath: { $ne: null } }, function (err, videos_list) { |
151 | if (err) { | 151 | if (err) { |
152 | logger.error('Cannot get list of the videos.', { error: err }) | 152 | logger.error('Cannot get the list of owned videos.') |
153 | return callback(err) | 153 | return callback(err) |
154 | } | 154 | } |
155 | 155 | ||
@@ -160,13 +160,13 @@ | |||
160 | function removeOwned (id, callback) { | 160 | function removeOwned (id, callback) { |
161 | VideosDB.findByIdAndRemove(id, function (err, video) { | 161 | VideosDB.findByIdAndRemove(id, function (err, video) { |
162 | if (err) { | 162 | if (err) { |
163 | logger.error('Cannot remove the torrent.', { error: err }) | 163 | logger.error('Cannot remove the torrent.') |
164 | return callback(err) | 164 | return callback(err) |
165 | } | 165 | } |
166 | 166 | ||
167 | fs.unlink(uploadDir + video.namePath, function (err) { | 167 | fs.unlink(uploadDir + video.namePath, function (err) { |
168 | if (err) { | 168 | if (err) { |
169 | logger.error('Cannot remove this video file.', { error: err }) | 169 | logger.error('Cannot remove this video file.') |
170 | return callback(err) | 170 | return callback(err) |
171 | } | 171 | } |
172 | 172 | ||
@@ -222,7 +222,7 @@ | |||
222 | function search (name, callback) { | 222 | function search (name, callback) { |
223 | VideosDB.find({ name: new RegExp(name) }, function (err, videos) { | 223 | VideosDB.find({ name: new RegExp(name) }, function (err, videos) { |
224 | if (err) { | 224 | if (err) { |
225 | logger.error('Cannot search the videos.', { error: err }) | 225 | logger.error('Cannot search the videos.') |
226 | return callback(err) | 226 | return callback(err) |
227 | } | 227 | } |
228 | 228 | ||