aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/pods.ts2
-rw-r--r--server/controllers/api/remote/videos.ts22
-rw-r--r--server/controllers/api/users.ts2
-rw-r--r--server/controllers/api/videos/abuse.ts2
-rw-r--r--server/controllers/api/videos/blacklist.ts2
-rw-r--r--server/controllers/api/videos/index.ts8
-rw-r--r--server/controllers/api/videos/rate.ts2
7 files changed, 20 insertions, 20 deletions
diff --git a/server/controllers/api/pods.ts b/server/controllers/api/pods.ts
index 0f85ab51d..55a7df661 100644
--- a/server/controllers/api/pods.ts
+++ b/server/controllers/api/pods.ts
@@ -81,7 +81,7 @@ function makeFriendsController (req: express.Request, res: express.Response, nex
81 81
82 makeFriends(hosts) 82 makeFriends(hosts)
83 .then(() => logger.info('Made friends!')) 83 .then(() => logger.info('Made friends!'))
84 .catch(err => logger.error('Could not make friends.', { error: err })) 84 .catch(err => logger.error('Could not make friends.', err))
85 85
86 // Don't wait the process that could be long 86 // Don't wait the process that could be long
87 res.type('json').status(204).end() 87 res.type('json').status(204).end()
diff --git a/server/controllers/api/remote/videos.ts b/server/controllers/api/remote/videos.ts
index eb033637e..fac85c3a8 100644
--- a/server/controllers/api/remote/videos.ts
+++ b/server/controllers/api/remote/videos.ts
@@ -76,7 +76,7 @@ function remoteVideos (req: express.Request, res: express.Response, next: expres
76 76
77 return fun.call(this, data, fromPod) 77 return fun.call(this, data, fromPod)
78 }) 78 })
79 .catch(err => logger.error('Error managing remote videos.', { error: err })) 79 .catch(err => logger.error('Error managing remote videos.', err))
80 80
81 // Don't block the other pod 81 // Don't block the other pod
82 return res.type('json').status(204).end() 82 return res.type('json').status(204).end()
@@ -91,7 +91,7 @@ function remoteVideosQadu (req: express.Request, res: express.Response, next: ex
91 91
92 return quickAndDirtyUpdateVideoRetryWrapper(videoData, fromPod) 92 return quickAndDirtyUpdateVideoRetryWrapper(videoData, fromPod)
93 }) 93 })
94 .catch(err => logger.error('Error managing remote videos.', { error: err })) 94 .catch(err => logger.error('Error managing remote videos.', err))
95 95
96 return res.type('json').status(204).end() 96 return res.type('json').status(204).end()
97} 97}
@@ -105,7 +105,7 @@ function remoteVideosEvents (req: express.Request, res: express.Response, next:
105 105
106 return processVideosEventsRetryWrapper(eventData, fromPod) 106 return processVideosEventsRetryWrapper(eventData, fromPod)
107 }) 107 })
108 .catch(err => logger.error('Error managing remote videos.', { error: err })) 108 .catch(err => logger.error('Error managing remote videos.', err))
109 109
110 return res.type('json').status(204).end() 110 return res.type('json').status(204).end()
111} 111}
@@ -167,7 +167,7 @@ function processVideosEvents (eventData: any, fromPod: PodInstance) {
167 }) 167 })
168 .then(() => logger.info('Remote video event processed for video %s.', eventData.remoteId)) 168 .then(() => logger.info('Remote video event processed for video %s.', eventData.remoteId))
169 .catch(err => { 169 .catch(err => {
170 logger.debug('Cannot process a video event.', { error: err }) 170 logger.debug('Cannot process a video event.', err)
171 throw err 171 throw err
172 }) 172 })
173} 173}
@@ -207,7 +207,7 @@ function quickAndDirtyUpdateVideo (videoData: any, fromPod: PodInstance) {
207 }) 207 })
208 }) 208 })
209 .then(() => logger.info('Remote video %s quick and dirty updated', videoName)) 209 .then(() => logger.info('Remote video %s quick and dirty updated', videoName))
210 .catch(err => logger.debug('Cannot quick and dirty update the remote video.', { error: err })) 210 .catch(err => logger.debug('Cannot quick and dirty update the remote video.', err))
211} 211}
212 212
213// Handle retries on fail 213// Handle retries on fail
@@ -287,7 +287,7 @@ function addRemoteVideo (videoToCreateData: any, fromPod: PodInstance) {
287 }) 287 })
288 .then(() => logger.info('Remote video %s inserted.', videoToCreateData.name)) 288 .then(() => logger.info('Remote video %s inserted.', videoToCreateData.name))
289 .catch(err => { 289 .catch(err => {
290 logger.debug('Cannot insert the remote video.', { error: err }) 290 logger.debug('Cannot insert the remote video.', err)
291 throw err 291 throw err
292 }) 292 })
293} 293}
@@ -341,7 +341,7 @@ function updateRemoteVideo (videoAttributesToUpdate: any, fromPod: PodInstance)
341 .then(() => logger.info('Remote video %s updated', videoAttributesToUpdate.name)) 341 .then(() => logger.info('Remote video %s updated', videoAttributesToUpdate.name))
342 .catch(err => { 342 .catch(err => {
343 // This is just a debug because we will retry the insert 343 // This is just a debug because we will retry the insert
344 logger.debug('Cannot update the remote video.', { error: err }) 344 logger.debug('Cannot update the remote video.', err)
345 throw err 345 throw err
346 }) 346 })
347} 347}
@@ -354,7 +354,7 @@ function removeRemoteVideo (videoToRemoveData: any, fromPod: PodInstance) {
354 return video.destroy() 354 return video.destroy()
355 }) 355 })
356 .catch(err => { 356 .catch(err => {
357 logger.debug('Could not fetch remote video.', { host: fromPod.host, remoteId: videoToRemoveData.remoteId, error: err }) 357 logger.debug('Could not fetch remote video.', { host: fromPod.host, remoteId: videoToRemoveData.remoteId, error: err.stack })
358 }) 358 })
359} 359}
360 360
@@ -372,7 +372,7 @@ function reportAbuseRemoteVideo (reportData: any, fromPod: PodInstance) {
372 372
373 return db.VideoAbuse.create(videoAbuseData) 373 return db.VideoAbuse.create(videoAbuseData)
374 }) 374 })
375 .catch(err => logger.error('Cannot create remote abuse video.', { error: err })) 375 .catch(err => logger.error('Cannot create remote abuse video.', err))
376} 376}
377 377
378function fetchOwnedVideo (id: string) { 378function fetchOwnedVideo (id: string) {
@@ -383,7 +383,7 @@ function fetchOwnedVideo (id: string) {
383 return video 383 return video
384 }) 384 })
385 .catch(err => { 385 .catch(err => {
386 logger.error('Cannot load owned video from id.', { error: err, id }) 386 logger.error('Cannot load owned video from id.', { error: err.stack, id })
387 throw err 387 throw err
388 }) 388 })
389} 389}
@@ -396,7 +396,7 @@ function fetchRemoteVideo (podHost: string, remoteId: string) {
396 return video 396 return video
397 }) 397 })
398 .catch(err => { 398 .catch(err => {
399 logger.error('Cannot load video from host and remote id.', { error: err, podHost, remoteId }) 399 logger.error('Cannot load video from host and remote id.', { error: err.stack, podHost, remoteId })
400 throw err 400 throw err
401 }) 401 })
402} 402}
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts
index 6e0bb474a..845facd55 100644
--- a/server/controllers/api/users.ts
+++ b/server/controllers/api/users.ts
@@ -126,7 +126,7 @@ function removeUser (req: express.Request, res: express.Response, next: express.
126 .then(user => user.destroy()) 126 .then(user => user.destroy())
127 .then(() => res.sendStatus(204)) 127 .then(() => res.sendStatus(204))
128 .catch(err => { 128 .catch(err => {
129 logger.error('Errors when removed the user.', { error: err }) 129 logger.error('Errors when removed the user.', err)
130 return next(err) 130 return next(err)
131 }) 131 })
132} 132}
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts
index fcbd5465f..3b1b7f58e 100644
--- a/server/controllers/api/videos/abuse.ts
+++ b/server/controllers/api/videos/abuse.ts
@@ -90,7 +90,7 @@ function reportVideoAbuse (req: express.Request, res: express.Response) {
90 }) 90 })
91 .then((videoInstance: VideoInstance) => logger.info('Abuse report for video %s created.', videoInstance.name)) 91 .then((videoInstance: VideoInstance) => logger.info('Abuse report for video %s created.', videoInstance.name))
92 .catch(err => { 92 .catch(err => {
93 logger.debug('Cannot update the video.', { error: err }) 93 logger.debug('Cannot update the video.', err)
94 throw err 94 throw err
95 }) 95 })
96} 96}
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts
index e4be6f0f9..d8f2068ec 100644
--- a/server/controllers/api/videos/blacklist.ts
+++ b/server/controllers/api/videos/blacklist.ts
@@ -35,7 +35,7 @@ function addVideoToBlacklist (req: express.Request, res: express.Response, next:
35 db.BlacklistedVideo.create(toCreate) 35 db.BlacklistedVideo.create(toCreate)
36 .then(() => res.type('json').status(204).end()) 36 .then(() => res.type('json').status(204).end())
37 .catch(err => { 37 .catch(err => {
38 logger.error('Errors when blacklisting video ', { error: err }) 38 logger.error('Errors when blacklisting video ', err)
39 return next(err) 39 return next(err)
40 }) 40 })
41} 41}
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index ed1f21d66..3532c753e 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -63,7 +63,7 @@ const storage = multer.diskStorage({
63 cb(null, filename + '.' + extension) 63 cb(null, filename + '.' + extension)
64 }) 64 })
65 .catch(err => { 65 .catch(err => {
66 logger.error('Cannot generate random string for file name.', { error: err }) 66 logger.error('Cannot generate random string for file name.', err)
67 throw err 67 throw err
68 }) 68 })
69 } 69 }
@@ -304,7 +304,7 @@ function updateVideo (req: express.Request, res: express.Response) {
304 logger.info('Video with name %s updated.', videoInstance.name) 304 logger.info('Video with name %s updated.', videoInstance.name)
305 }) 305 })
306 .catch(err => { 306 .catch(err => {
307 logger.debug('Cannot update the video.', { error: err }) 307 logger.debug('Cannot update the video.', err)
308 308
309 // Force fields we want to update 309 // Force fields we want to update
310 // If the transaction is retried, sequelize will think the object has not changed 310 // If the transaction is retried, sequelize will think the object has not changed
@@ -333,7 +333,7 @@ function getVideo (req: express.Request, res: express.Response, next: express.Ne
333 } 333 }
334 return quickAndDirtyUpdateVideoToFriends(qaduParams) 334 return quickAndDirtyUpdateVideoToFriends(qaduParams)
335 }) 335 })
336 .catch(err => logger.error('Cannot add view to video %d.', videoInstance.id, { error: err })) 336 .catch(err => logger.error('Cannot add view to video %d.', videoInstance.id, err))
337 } else { 337 } else {
338 // Just send the event to our friends 338 // Just send the event to our friends
339 const eventParams = { 339 const eventParams = {
@@ -359,7 +359,7 @@ function removeVideo (req: express.Request, res: express.Response, next: express
359 videoInstance.destroy() 359 videoInstance.destroy()
360 .then(() => res.type('json').status(204).end()) 360 .then(() => res.type('json').status(204).end())
361 .catch(err => { 361 .catch(err => {
362 logger.error('Errors when removed the video.', { error: err }) 362 logger.error('Errors when removed the video.', err)
363 return next(err) 363 return next(err)
364 }) 364 })
365} 365}
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts
index 3d119d98b..dfb5a450f 100644
--- a/server/controllers/api/videos/rate.ts
+++ b/server/controllers/api/videos/rate.ts
@@ -143,7 +143,7 @@ function rateVideo (req: express.Request, res: express.Response) {
143 .then(() => logger.info('User video rate for video %s of user %s updated.', videoInstance.name, userInstance.username)) 143 .then(() => logger.info('User video rate for video %s of user %s updated.', videoInstance.name, userInstance.username))
144 .catch(err => { 144 .catch(err => {
145 // This is just a debug because we will retry the insert 145 // This is just a debug because we will retry the insert
146 logger.debug('Cannot add the user video rate.', { error: err }) 146 logger.debug('Cannot add the user video rate.', err)
147 throw err 147 throw err
148 }) 148 })
149} 149}