diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-07-07 18:26:12 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-07-07 18:26:12 +0200 |
commit | ad0997adfb9e1e3b1ff54338d7558cf7b18440ea (patch) | |
tree | 78ef53699d260e194bbcda7eccb645a14070679a /server | |
parent | 709756b8e183f67ef9bf8f7bc149af4736260350 (diff) | |
download | PeerTube-ad0997adfb9e1e3b1ff54338d7558cf7b18440ea.tar.gz PeerTube-ad0997adfb9e1e3b1ff54338d7558cf7b18440ea.tar.zst PeerTube-ad0997adfb9e1e3b1ff54338d7558cf7b18440ea.zip |
Fix error logging
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/pods.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/remote/videos.ts | 22 | ||||
-rw-r--r-- | server/controllers/api/users.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/abuse.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/blacklist.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 8 | ||||
-rw-r--r-- | server/controllers/api/videos/rate.ts | 2 | ||||
-rw-r--r-- | server/helpers/database-utils.ts | 2 | ||||
-rw-r--r-- | server/helpers/peertube-crypto.ts | 4 | ||||
-rw-r--r-- | server/lib/friends.ts | 6 | ||||
-rw-r--r-- | server/lib/jobs/handlers/video-transcoder.ts | 2 | ||||
-rw-r--r-- | server/lib/jobs/job-scheduler.ts | 10 | ||||
-rw-r--r-- | server/lib/request/abstract-request-scheduler.ts | 4 | ||||
-rw-r--r-- | server/lib/request/request-scheduler.ts | 2 | ||||
-rw-r--r-- | server/middlewares/oauth.ts | 2 | ||||
-rw-r--r-- | server/middlewares/validators/pods.ts | 4 | ||||
-rw-r--r-- | server/middlewares/validators/users.ts | 6 | ||||
-rw-r--r-- | server/middlewares/validators/videos.ts | 6 | ||||
-rw-r--r-- | server/models/oauth/oauth-token.ts | 2 | ||||
-rw-r--r-- | server/models/pod/pod.ts | 6 | ||||
-rw-r--r-- | server/models/video/video.ts | 2 |
21 files changed, 49 insertions, 49 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 | ||
378 | function fetchOwnedVideo (id: string) { | 378 | function 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 | } |
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts index f761cfb89..e174dc3e9 100644 --- a/server/helpers/database-utils.ts +++ b/server/helpers/database-utils.ts | |||
@@ -17,7 +17,7 @@ function retryTransactionWrapper (functionToRetry: (... args) => Promise<any>, o | |||
17 | ) | 17 | ) |
18 | .catch(err => { | 18 | .catch(err => { |
19 | // Do not throw the error, continue the process | 19 | // Do not throw the error, continue the process |
20 | logger.error(options.errorMessage, { error: err }) | 20 | logger.error(options.errorMessage, err) |
21 | }) | 21 | }) |
22 | } | 22 | } |
23 | 23 | ||
diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts index 0c73e8539..89aef99c4 100644 --- a/server/helpers/peertube-crypto.ts +++ b/server/helpers/peertube-crypto.ts | |||
@@ -30,7 +30,7 @@ function checkSignature (publicKey: string, data: string, hexSignature: string) | |||
30 | try { | 30 | try { |
31 | dataString = JSON.stringify(data) | 31 | dataString = JSON.stringify(data) |
32 | } catch (err) { | 32 | } catch (err) { |
33 | logger.error('Cannot check signature.', { error: err }) | 33 | logger.error('Cannot check signature.', err) |
34 | return false | 34 | return false |
35 | } | 35 | } |
36 | } | 36 | } |
@@ -51,7 +51,7 @@ function sign (data: string|Object) { | |||
51 | try { | 51 | try { |
52 | dataString = JSON.stringify(data) | 52 | dataString = JSON.stringify(data) |
53 | } catch (err) { | 53 | } catch (err) { |
54 | logger.error('Cannot sign data.', { error: err }) | 54 | logger.error('Cannot sign data.', err) |
55 | return Promise.resolve('') | 55 | return Promise.resolve('') |
56 | } | 56 | } |
57 | } | 57 | } |
diff --git a/server/lib/friends.ts b/server/lib/friends.ts index c24839cb6..3487addbe 100644 --- a/server/lib/friends.ts +++ b/server/lib/friends.ts | |||
@@ -180,7 +180,7 @@ function quitFriends () { | |||
180 | }, { concurrency: REQUESTS_IN_PARALLEL }) | 180 | }, { concurrency: REQUESTS_IN_PARALLEL }) |
181 | .then(() => pods) | 181 | .then(() => pods) |
182 | .catch(err => { | 182 | .catch(err => { |
183 | logger.error('Some errors while quitting friends.', { err: err }) | 183 | logger.error('Some errors while quitting friends.', err) |
184 | // Don't stop the process | 184 | // Don't stop the process |
185 | }) | 185 | }) |
186 | }) | 186 | }) |
@@ -215,7 +215,7 @@ function sendOwnedVideosToPod (podId: number) { | |||
215 | return createRequest(options) | 215 | return createRequest(options) |
216 | }) | 216 | }) |
217 | .catch(err => { | 217 | .catch(err => { |
218 | logger.error('Cannot convert video to remote.', { error: err }) | 218 | logger.error('Cannot convert video to remote.', err) |
219 | // Don't break the process | 219 | // Don't break the process |
220 | return undefined | 220 | return undefined |
221 | }) | 221 | }) |
@@ -344,7 +344,7 @@ function makeRequestsToWinningPods (cert: string, podsList: PodInstance[]) { | |||
344 | sendOwnedVideosToPod(podCreated.id) | 344 | sendOwnedVideosToPod(podCreated.id) |
345 | }) | 345 | }) |
346 | .catch(err => { | 346 | .catch(err => { |
347 | logger.error('Cannot add friend %s pod.', pod.host, { error: err }) | 347 | logger.error('Cannot add friend %s pod.', pod.host, err) |
348 | }) | 348 | }) |
349 | } else { | 349 | } else { |
350 | logger.error('Status not 200 for %s pod.', pod.host) | 350 | logger.error('Status not 200 for %s pod.', pod.host) |
diff --git a/server/lib/jobs/handlers/video-transcoder.ts b/server/lib/jobs/handlers/video-transcoder.ts index e829ca813..eeb2d57b0 100644 --- a/server/lib/jobs/handlers/video-transcoder.ts +++ b/server/lib/jobs/handlers/video-transcoder.ts | |||
@@ -10,7 +10,7 @@ function process (data: { id: string }) { | |||
10 | } | 10 | } |
11 | 11 | ||
12 | function onError (err: Error, jobId: number) { | 12 | function onError (err: Error, jobId: number) { |
13 | logger.error('Error when transcoding video file in job %d.', jobId, { error: err }) | 13 | logger.error('Error when transcoding video file in job %d.', jobId, err) |
14 | return Promise.resolve() | 14 | return Promise.resolve() |
15 | } | 15 | } |
16 | 16 | ||
diff --git a/server/lib/jobs/job-scheduler.ts b/server/lib/jobs/job-scheduler.ts index 248dc7978..2ae732b0f 100644 --- a/server/lib/jobs/job-scheduler.ts +++ b/server/lib/jobs/job-scheduler.ts | |||
@@ -51,13 +51,13 @@ class JobScheduler { | |||
51 | // Optimization: we could use "drain" from queue object | 51 | // Optimization: we could use "drain" from queue object |
52 | return setTimeout(next, JOBS_FETCHING_INTERVAL) | 52 | return setTimeout(next, JOBS_FETCHING_INTERVAL) |
53 | }) | 53 | }) |
54 | .catch(err => logger.error('Cannot list pending jobs.', { error: err })) | 54 | .catch(err => logger.error('Cannot list pending jobs.', err)) |
55 | }, | 55 | }, |
56 | 56 | ||
57 | err => logger.error('Error in job scheduler queue.', { error: err }) | 57 | err => logger.error('Error in job scheduler queue.', err) |
58 | ) | 58 | ) |
59 | }) | 59 | }) |
60 | .catch(err => logger.error('Cannot list pending jobs.', { error: err })) | 60 | .catch(err => logger.error('Cannot list pending jobs.', err)) |
61 | } | 61 | } |
62 | 62 | ||
63 | createJob (transaction: Sequelize.Transaction, handlerName: string, handlerInputData: object) { | 63 | createJob (transaction: Sequelize.Transaction, handlerName: string, handlerInputData: object) { |
@@ -95,7 +95,7 @@ class JobScheduler { | |||
95 | }, | 95 | }, |
96 | 96 | ||
97 | err => { | 97 | err => { |
98 | logger.error('Error in job handler %s.', job.handlerName, { error: err }) | 98 | logger.error('Error in job handler %s.', job.handlerName, err) |
99 | return this.onJobError(jobHandler, job, err) | 99 | return this.onJobError(jobHandler, job, err) |
100 | } | 100 | } |
101 | ) | 101 | ) |
@@ -123,7 +123,7 @@ class JobScheduler { | |||
123 | } | 123 | } |
124 | 124 | ||
125 | private cannotSaveJobError (err: Error) { | 125 | private cannotSaveJobError (err: Error) { |
126 | logger.error('Cannot save new job state.', { error: err }) | 126 | logger.error('Cannot save new job state.', err) |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
diff --git a/server/lib/request/abstract-request-scheduler.ts b/server/lib/request/abstract-request-scheduler.ts index 128fc5b28..0a9ff65d5 100644 --- a/server/lib/request/abstract-request-scheduler.ts +++ b/server/lib/request/abstract-request-scheduler.ts | |||
@@ -84,7 +84,7 @@ abstract class AbstractRequestScheduler <T> { | |||
84 | } | 84 | } |
85 | }) | 85 | }) |
86 | .catch(err => { | 86 | .catch(err => { |
87 | logger.error('Error sending secure request to %s pod.', toPod.host, { error: err }) | 87 | logger.error('Error sending secure request to %s pod.', toPod.host, err) |
88 | 88 | ||
89 | throw err | 89 | throw err |
90 | }) | 90 | }) |
@@ -124,7 +124,7 @@ abstract class AbstractRequestScheduler <T> { | |||
124 | }) | 124 | }) |
125 | .catch(err => { | 125 | .catch(err => { |
126 | badPods.push(requestToMake.toPod.id) | 126 | badPods.push(requestToMake.toPod.id) |
127 | logger.info('Cannot make request to %s.', toPod.host, { error: err }) | 127 | logger.info('Cannot make request to %s.', toPod.host, err) |
128 | }) | 128 | }) |
129 | }, { concurrency: REQUESTS_IN_PARALLEL }).then(() => ({ goodPods, badPods })) | 129 | }, { concurrency: REQUESTS_IN_PARALLEL }).then(() => ({ goodPods, badPods })) |
130 | }) | 130 | }) |
diff --git a/server/lib/request/request-scheduler.ts b/server/lib/request/request-scheduler.ts index 8927d53bb..3945ace20 100644 --- a/server/lib/request/request-scheduler.ts +++ b/server/lib/request/request-scheduler.ts | |||
@@ -87,7 +87,7 @@ class RequestScheduler extends AbstractRequestScheduler<RequestsGrouped> { | |||
87 | afterRequestsHook () { | 87 | afterRequestsHook () { |
88 | // Flush requests with no pod | 88 | // Flush requests with no pod |
89 | this.getRequestModel().removeWithEmptyTo() | 89 | this.getRequestModel().removeWithEmptyTo() |
90 | .catch(err => logger.error('Error when removing requests with no pods.', { error: err })) | 90 | .catch(err => logger.error('Error when removing requests with no pods.', err)) |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.ts index d545b3e58..fe0490436 100644 --- a/server/middlewares/oauth.ts +++ b/server/middlewares/oauth.ts | |||
@@ -14,7 +14,7 @@ const oAuthServer = new OAuthServer({ | |||
14 | function authenticate (req: express.Request, res: express.Response, next: express.NextFunction) { | 14 | function authenticate (req: express.Request, res: express.Response, next: express.NextFunction) { |
15 | oAuthServer.authenticate()(req, res, function (err) { | 15 | oAuthServer.authenticate()(req, res, function (err) { |
16 | if (err) { | 16 | if (err) { |
17 | logger.error('Cannot authenticate.', { error: err }) | 17 | logger.error('Cannot authenticate.', err) |
18 | return res.sendStatus(500) | 18 | return res.sendStatus(500) |
19 | } | 19 | } |
20 | 20 | ||
diff --git a/server/middlewares/validators/pods.ts b/server/middlewares/validators/pods.ts index da7fc2bd6..022fd7f9a 100644 --- a/server/middlewares/validators/pods.ts +++ b/server/middlewares/validators/pods.ts | |||
@@ -29,7 +29,7 @@ function makeFriendsValidator (req: express.Request, res: express.Response, next | |||
29 | return next() | 29 | return next() |
30 | }) | 30 | }) |
31 | .catch(err => { | 31 | .catch(err => { |
32 | logger.error('Cannot know if we have friends.', { error: err }) | 32 | logger.error('Cannot know if we have friends.', err) |
33 | res.sendStatus(500) | 33 | res.sendStatus(500) |
34 | }) | 34 | }) |
35 | }) | 35 | }) |
@@ -52,7 +52,7 @@ function podsAddValidator (req: express.Request, res: express.Response, next: ex | |||
52 | return next() | 52 | return next() |
53 | }) | 53 | }) |
54 | .catch(err => { | 54 | .catch(err => { |
55 | logger.error('Cannot load pod by host.', { error: err }) | 55 | logger.error('Cannot load pod by host.', err) |
56 | res.sendStatus(500) | 56 | res.sendStatus(500) |
57 | }) | 57 | }) |
58 | }) | 58 | }) |
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index c06735047..9db4fff77 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -20,7 +20,7 @@ function usersAddValidator (req: express.Request, res: express.Response, next: e | |||
20 | next() | 20 | next() |
21 | }) | 21 | }) |
22 | .catch(err => { | 22 | .catch(err => { |
23 | logger.error('Error in usersAdd request validator.', { error: err }) | 23 | logger.error('Error in usersAdd request validator.', err) |
24 | return res.sendStatus(500) | 24 | return res.sendStatus(500) |
25 | }) | 25 | }) |
26 | }) | 26 | }) |
@@ -41,7 +41,7 @@ function usersRemoveValidator (req: express.Request, res: express.Response, next | |||
41 | next() | 41 | next() |
42 | }) | 42 | }) |
43 | .catch(err => { | 43 | .catch(err => { |
44 | logger.error('Error in usersRemove request validator.', { error: err }) | 44 | logger.error('Error in usersRemove request validator.', err) |
45 | return res.sendStatus(500) | 45 | return res.sendStatus(500) |
46 | }) | 46 | }) |
47 | }) | 47 | }) |
@@ -71,7 +71,7 @@ function usersVideoRatingValidator (req: express.Request, res: express.Response, | |||
71 | next() | 71 | next() |
72 | }) | 72 | }) |
73 | .catch(err => { | 73 | .catch(err => { |
74 | logger.error('Error in user request validator.', { error: err }) | 74 | logger.error('Error in user request validator.', err) |
75 | return res.sendStatus(500) | 75 | return res.sendStatus(500) |
76 | }) | 76 | }) |
77 | }) | 77 | }) |
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index ec452cade..013466487 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts | |||
@@ -33,7 +33,7 @@ function videosAddValidator (req: express.Request, res: express.Response, next: | |||
33 | next() | 33 | next() |
34 | }) | 34 | }) |
35 | .catch(err => { | 35 | .catch(err => { |
36 | logger.error('Error in getting duration from file.', { error: err }) | 36 | logger.error('Error in getting duration from file.', err) |
37 | res.status(400).send('Cannot retrieve metadata of the file.') | 37 | res.status(400).send('Cannot retrieve metadata of the file.') |
38 | }) | 38 | }) |
39 | }) | 39 | }) |
@@ -164,7 +164,7 @@ function checkVideoExists (id: string, res: express.Response, callback: () => vo | |||
164 | callback() | 164 | callback() |
165 | }) | 165 | }) |
166 | .catch(err => { | 166 | .catch(err => { |
167 | logger.error('Error in video request validator.', { error: err }) | 167 | logger.error('Error in video request validator.', err) |
168 | return res.sendStatus(500) | 168 | return res.sendStatus(500) |
169 | }) | 169 | }) |
170 | } | 170 | } |
@@ -190,7 +190,7 @@ function checkUserCanDeleteVideo (userId: number, res: express.Response, callbac | |||
190 | callback() | 190 | callback() |
191 | }) | 191 | }) |
192 | .catch(err => { | 192 | .catch(err => { |
193 | logger.error('Error in video request validator.', { error: err }) | 193 | logger.error('Error in video request validator.', err) |
194 | return res.sendStatus(500) | 194 | return res.sendStatus(500) |
195 | }) | 195 | }) |
196 | } | 196 | } |
diff --git a/server/models/oauth/oauth-token.ts b/server/models/oauth/oauth-token.ts index 8c6883465..a0a13aab7 100644 --- a/server/models/oauth/oauth-token.ts +++ b/server/models/oauth/oauth-token.ts | |||
@@ -114,7 +114,7 @@ getByRefreshTokenAndPopulateClient = function (refreshToken: string) { | |||
114 | 114 | ||
115 | return tokenInfos | 115 | return tokenInfos |
116 | }).catch(function (err) { | 116 | }).catch(function (err) { |
117 | logger.info('getRefreshToken error.', { error: err }) | 117 | logger.info('getRefreshToken error.', err) |
118 | }) | 118 | }) |
119 | } | 119 | } |
120 | 120 | ||
diff --git a/server/models/pod/pod.ts b/server/models/pod/pod.ts index 9209380fc..62d9e3c6c 100644 --- a/server/models/pod/pod.ts +++ b/server/models/pod/pod.ts | |||
@@ -216,7 +216,7 @@ updatePodsScore = function (goodPods: number[], badPods: number[]) { | |||
216 | 216 | ||
217 | if (goodPods.length !== 0) { | 217 | if (goodPods.length !== 0) { |
218 | incrementScores(goodPods, PODS_SCORE.BONUS).catch(err => { | 218 | incrementScores(goodPods, PODS_SCORE.BONUS).catch(err => { |
219 | logger.error('Cannot increment scores of good pods.', { error: err }) | 219 | logger.error('Cannot increment scores of good pods.', err) |
220 | }) | 220 | }) |
221 | } | 221 | } |
222 | 222 | ||
@@ -224,7 +224,7 @@ updatePodsScore = function (goodPods: number[], badPods: number[]) { | |||
224 | incrementScores(badPods, PODS_SCORE.MALUS) | 224 | incrementScores(badPods, PODS_SCORE.MALUS) |
225 | .then(() => removeBadPods()) | 225 | .then(() => removeBadPods()) |
226 | .catch(err => { | 226 | .catch(err => { |
227 | if (err) logger.error('Cannot decrement scores of bad pods.', { error: err }) | 227 | if (err) logger.error('Cannot decrement scores of bad pods.', err) |
228 | }) | 228 | }) |
229 | } | 229 | } |
230 | } | 230 | } |
@@ -246,6 +246,6 @@ function removeBadPods () { | |||
246 | } | 246 | } |
247 | }) | 247 | }) |
248 | .catch(err => { | 248 | .catch(err => { |
249 | logger.error('Cannot remove bad pods.', { error: err }) | 249 | logger.error('Cannot remove bad pods.', err) |
250 | }) | 250 | }) |
251 | } | 251 | } |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 3d71e8d9e..47d3cad1d 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -553,7 +553,7 @@ transcodeVideofile = function (this: VideoInstance) { | |||
553 | .catch(err => { | 553 | .catch(err => { |
554 | // Autodesctruction... | 554 | // Autodesctruction... |
555 | video.destroy().asCallback(function (err) { | 555 | video.destroy().asCallback(function (err) { |
556 | if (err) logger.error('Cannot destruct video after transcoding failure.', { error: err }) | 556 | if (err) logger.error('Cannot destruct video after transcoding failure.', err) |
557 | }) | 557 | }) |
558 | 558 | ||
559 | return rej(err) | 559 | return rej(err) |