diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-11 16:22:50 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-11 16:22:50 +0100 |
commit | dea32aacde362a5fbd62a88cd32487768b788468 (patch) | |
tree | 3e11525470bb5a2ba0bfba99087f107494f49edf /server/controllers/api/videos.js | |
parent | bf4ff8fe0be63422c05d42e12f25b454bb95d1a5 (diff) | |
download | PeerTube-dea32aacde362a5fbd62a88cd32487768b788468.tar.gz PeerTube-dea32aacde362a5fbd62a88cd32487768b788468.tar.zst PeerTube-dea32aacde362a5fbd62a88cd32487768b788468.zip |
Server: always check commit result
Diffstat (limited to 'server/controllers/api/videos.js')
-rw-r--r-- | server/controllers/api/videos.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/server/controllers/api/videos.js b/server/controllers/api/videos.js index 6573b1210..df068f961 100644 --- a/server/controllers/api/videos.js +++ b/server/controllers/api/videos.js | |||
@@ -231,11 +231,12 @@ function addVideo (req, res, videoFile, callback) { | |||
231 | } | 231 | } |
232 | 232 | ||
233 | // Commit transaction | 233 | // Commit transaction |
234 | t.commit() | 234 | t.commit().asCallback(function (err) { |
235 | if (err) return callback(err) | ||
235 | 236 | ||
236 | logger.info('Video with name %s created.', videoInfos.name) | 237 | logger.info('Video with name %s created.', videoInfos.name) |
237 | 238 | return callback(null) | |
238 | return callback(null) | 239 | }) |
239 | }) | 240 | }) |
240 | } | 241 | } |
241 | 242 | ||
@@ -324,9 +325,12 @@ function updateVideo (req, res, finalCallback) { | |||
324 | } | 325 | } |
325 | 326 | ||
326 | // Commit transaction | 327 | // Commit transaction |
327 | t.commit() | 328 | t.commit().asCallback(function (err) { |
329 | if (err) return finalCallback(err) | ||
328 | 330 | ||
329 | return finalCallback(null) | 331 | logger.info('Video with name %s updated.', videoInfosToUpdate.name) |
332 | return finalCallback(null) | ||
333 | }) | ||
330 | }) | 334 | }) |
331 | } | 335 | } |
332 | 336 | ||
@@ -442,9 +446,12 @@ function reportVideoAbuse (req, res, finalCallback) { | |||
442 | } | 446 | } |
443 | 447 | ||
444 | // Commit transaction | 448 | // Commit transaction |
445 | t.commit() | 449 | t.commit().asCallback(function (err) { |
450 | if (err) return finalCallback(err) | ||
446 | 451 | ||
447 | return finalCallback(null) | 452 | logger.info('Abuse report for video %s created.', videoInstance.name) |
453 | return finalCallback(null) | ||
454 | }) | ||
448 | }) | 455 | }) |
449 | } | 456 | } |
450 | 457 | ||