aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-07 18:26:12 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-07 18:26:12 +0200
commitad0997adfb9e1e3b1ff54338d7558cf7b18440ea (patch)
tree78ef53699d260e194bbcda7eccb645a14070679a /server/lib
parent709756b8e183f67ef9bf8f7bc149af4736260350 (diff)
downloadPeerTube-ad0997adfb9e1e3b1ff54338d7558cf7b18440ea.tar.gz
PeerTube-ad0997adfb9e1e3b1ff54338d7558cf7b18440ea.tar.zst
PeerTube-ad0997adfb9e1e3b1ff54338d7558cf7b18440ea.zip
Fix error logging
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/friends.ts6
-rw-r--r--server/lib/jobs/handlers/video-transcoder.ts2
-rw-r--r--server/lib/jobs/job-scheduler.ts10
-rw-r--r--server/lib/request/abstract-request-scheduler.ts4
-rw-r--r--server/lib/request/request-scheduler.ts2
5 files changed, 12 insertions, 12 deletions
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
12function onError (err: Error, jobId: number) { 12function 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