aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-26 15:54:13 +0200
committerChocobozzz <me@florianbigard.com>2018-03-26 16:04:14 +0200
commitd5b7d9110dd637a7f67ce9e430145314812a8df1 (patch)
treed019ef5fe68b14d7e5ad11953b6c1f4811669ce6 /server/lib
parent0dcf9a14be3f8668fe5ee65cf0365d457b4d1499 (diff)
downloadPeerTube-d5b7d9110dd637a7f67ce9e430145314812a8df1.tar.gz
PeerTube-d5b7d9110dd637a7f67ce9e430145314812a8df1.tar.zst
PeerTube-d5b7d9110dd637a7f67ce9e430145314812a8df1.zip
Fix error logging
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/actor.ts8
-rw-r--r--server/lib/activitypub/process/process-update.ts6
-rw-r--r--server/lib/activitypub/video-comments.ts2
-rw-r--r--server/lib/activitypub/videos.ts2
-rw-r--r--server/lib/emailer.ts2
-rw-r--r--server/lib/job-queue/job-queue.ts4
-rw-r--r--server/lib/redis.ts2
-rw-r--r--server/lib/schedulers/bad-actor-follow-scheduler.ts2
8 files changed, 14 insertions, 14 deletions
diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts
index fa31e71c7..b0cf9bb17 100644
--- a/server/lib/activitypub/actor.ts
+++ b/server/lib/activitypub/actor.ts
@@ -30,7 +30,7 @@ function setAsyncActorKeys (actor: ActorModel) {
30 return actor.save() 30 return actor.save()
31 }) 31 })
32 .catch(err => { 32 .catch(err => {
33 logger.error('Cannot set public/private keys of actor %d.', actor.uuid, err) 33 logger.error('Cannot set public/private keys of actor %d.', actor.uuid, { err })
34 return actor 34 return actor
35 }) 35 })
36} 36}
@@ -117,7 +117,7 @@ async function updateActorAvatarInstance (actorInstance: ActorModel, avatarName:
117 try { 117 try {
118 await actorInstance.Avatar.destroy({ transaction: t }) 118 await actorInstance.Avatar.destroy({ transaction: t })
119 } catch (err) { 119 } catch (err) {
120 logger.error('Cannot remove old avatar of actor %s.', actorInstance.url, err) 120 logger.error('Cannot remove old avatar of actor %s.', actorInstance.url, { err })
121 } 121 }
122 } 122 }
123 123
@@ -144,7 +144,7 @@ async function fetchActorTotalItems (url: string) {
144 const { body } = await doRequest(options) 144 const { body } = await doRequest(options)
145 return body.totalItems ? body.totalItems : 0 145 return body.totalItems ? body.totalItems : 0
146 } catch (err) { 146 } catch (err) {
147 logger.warn('Cannot fetch remote actor count %s.', url, err) 147 logger.warn('Cannot fetch remote actor count %s.', url, { err })
148 return 0 148 return 0
149 } 149 }
150} 150}
@@ -393,7 +393,7 @@ async function refreshActorIfNeeded (actor: ActorModel) {
393 return actor 393 return actor
394 }) 394 })
395 } catch (err) { 395 } catch (err) {
396 logger.warn('Cannot refresh actor.', err) 396 logger.warn('Cannot refresh actor.', { err })
397 return actor 397 return actor
398 } 398 }
399} 399}
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts
index 24e5589d4..51e3cc4e3 100644
--- a/server/lib/activitypub/process/process-update.ts
+++ b/server/lib/activitypub/process/process-update.ts
@@ -92,7 +92,7 @@ async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) {
92 92
93 // Don't block on request 93 // Don't block on request
94 generateThumbnailFromUrl(videoInstance, videoAttributesToUpdate.icon) 94 generateThumbnailFromUrl(videoInstance, videoAttributesToUpdate.icon)
95 .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoAttributesToUpdate.id, err)) 95 .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoAttributesToUpdate.id, { err }))
96 96
97 // Remove old video files 97 // Remove old video files
98 const videoFileDestroyTasks: Bluebird<void>[] = [] 98 const videoFileDestroyTasks: Bluebird<void>[] = []
@@ -117,7 +117,7 @@ async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) {
117 } 117 }
118 118
119 // This is just a debug because we will retry the insert 119 // This is just a debug because we will retry the insert
120 logger.debug('Cannot update the remote video.', err) 120 logger.debug('Cannot update the remote video.', { err })
121 throw err 121 throw err
122 } 122 }
123} 123}
@@ -176,7 +176,7 @@ async function updateRemoteActor (actor: ActorModel, activity: ActivityUpdate) {
176 } 176 }
177 177
178 // This is just a debug because we will retry the insert 178 // This is just a debug because we will retry the insert
179 logger.debug('Cannot update the remote account.', err) 179 logger.debug('Cannot update the remote account.', { err })
180 throw err 180 throw err
181 } 181 }
182} 182}
diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts
index b33ae27b1..8ab0cdba4 100644
--- a/server/lib/activitypub/video-comments.ts
+++ b/server/lib/activitypub/video-comments.ts
@@ -111,7 +111,7 @@ async function resolveThread (url: string, comments: VideoCommentModel[] = []) {
111 111
112 return { video, parents: comments } 112 return { video, parents: comments }
113 } catch (err) { 113 } catch (err) {
114 logger.debug('Cannot get or create account and video and channel for reply %s, fetch comment', url, err) 114 logger.debug('Cannot get or create account and video and channel for reply %s, fetch comment', url, { err })
115 115
116 if (comments.length > ACTIVITY_PUB.MAX_RECURSION_COMMENTS) { 116 if (comments.length > ACTIVITY_PUB.MAX_RECURSION_COMMENTS) {
117 throw new Error('Recursion limit reached when resolving a thread') 117 throw new Error('Recursion limit reached when resolving a thread')
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index 2a6636625..ffba1570b 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -152,7 +152,7 @@ async function getOrCreateVideo (videoObject: VideoTorrentObject, channelActor:
152 152
153 // Don't block on request 153 // Don't block on request
154 generateThumbnailFromUrl(video, videoObject.icon) 154 generateThumbnailFromUrl(video, videoObject.icon)
155 .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoObject.id, err)) 155 .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoObject.id, { err }))
156 156
157 const videoCreated = await video.save(sequelizeOptions) 157 const videoCreated = await video.save(sequelizeOptions)
158 158
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts
index f34d141ea..85cc725fa 100644
--- a/server/lib/emailer.ts
+++ b/server/lib/emailer.ts
@@ -119,7 +119,7 @@ class Emailer {
119 } 119 }
120 120
121 private dieOnConnectionFailure (err?: Error) { 121 private dieOnConnectionFailure (err?: Error) {
122 logger.error('Failed to connect to SMTP %s:%d.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT, err) 122 logger.error('Failed to connect to SMTP %s:%d.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT, { err })
123 process.exit(-1) 123 process.exit(-1)
124 } 124 }
125 125
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts
index 66cced59a..1dc28755e 100644
--- a/server/lib/job-queue/job-queue.ts
+++ b/server/lib/job-queue/job-queue.ts
@@ -53,7 +53,7 @@ class JobQueue {
53 this.jobQueue.setMaxListeners(15) 53 this.jobQueue.setMaxListeners(15)
54 54
55 this.jobQueue.on('error', err => { 55 this.jobQueue.on('error', err => {
56 logger.error('Error in job queue.', err) 56 logger.error('Error in job queue.', { err })
57 process.exit(-1) 57 process.exit(-1)
58 }) 58 })
59 this.jobQueue.watchStuckJobs(5000) 59 this.jobQueue.watchStuckJobs(5000)
@@ -111,7 +111,7 @@ class JobQueue {
111 const now = new Date().getTime() 111 const now = new Date().getTime()
112 kue.Job.rangeByState('complete', 0, -1, 'asc', (err, jobs) => { 112 kue.Job.rangeByState('complete', 0, -1, 'asc', (err, jobs) => {
113 if (err) { 113 if (err) {
114 logger.error('Cannot get jobs when removing old jobs.', err) 114 logger.error('Cannot get jobs when removing old jobs.', { err })
115 return 115 return
116 } 116 }
117 117
diff --git a/server/lib/redis.ts b/server/lib/redis.ts
index 1fd366401..41f4c9869 100644
--- a/server/lib/redis.ts
+++ b/server/lib/redis.ts
@@ -23,7 +23,7 @@ class Redis {
23 }) 23 })
24 24
25 this.client.on('error', err => { 25 this.client.on('error', err => {
26 logger.error('Error in Redis client.', err) 26 logger.error('Error in Redis client.', { err })
27 process.exit(-1) 27 process.exit(-1)
28 }) 28 })
29 29
diff --git a/server/lib/schedulers/bad-actor-follow-scheduler.ts b/server/lib/schedulers/bad-actor-follow-scheduler.ts
index 9b9f9e17d..121f7145e 100644
--- a/server/lib/schedulers/bad-actor-follow-scheduler.ts
+++ b/server/lib/schedulers/bad-actor-follow-scheduler.ts
@@ -17,7 +17,7 @@ export class BadActorFollowScheduler extends AbstractScheduler {
17 try { 17 try {
18 await ActorFollowModel.removeBadActorFollows() 18 await ActorFollowModel.removeBadActorFollows()
19 } catch (err) { 19 } catch (err) {
20 logger.error('Error in bad actor follows scheduler.', err) 20 logger.error('Error in bad actor follows scheduler.', { err })
21 } 21 }
22 } 22 }
23 23