aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
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/middlewares
parent709756b8e183f67ef9bf8f7bc149af4736260350 (diff)
downloadPeerTube-ad0997adfb9e1e3b1ff54338d7558cf7b18440ea.tar.gz
PeerTube-ad0997adfb9e1e3b1ff54338d7558cf7b18440ea.tar.zst
PeerTube-ad0997adfb9e1e3b1ff54338d7558cf7b18440ea.zip
Fix error logging
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/oauth.ts2
-rw-r--r--server/middlewares/validators/pods.ts4
-rw-r--r--server/middlewares/validators/users.ts6
-rw-r--r--server/middlewares/validators/videos.ts6
4 files changed, 9 insertions, 9 deletions
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({
14function authenticate (req: express.Request, res: express.Response, next: express.NextFunction) { 14function 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}