aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/error.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-08 11:32:45 +0100
committerChocobozzz <me@florianbigard.com>2021-12-08 16:12:49 +0100
commit38d69d65012c8bf01bceb672be99f94fe414f275 (patch)
tree80ba6d43c4ce7ccff0c64d0c0817f43cc02a6531 /server/middlewares/error.ts
parent9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231 (diff)
downloadPeerTube-38d69d65012c8bf01bceb672be99f94fe414f275.tar.gz
PeerTube-38d69d65012c8bf01bceb672be99f94fe414f275.tar.zst
PeerTube-38d69d65012c8bf01bceb672be99f94fe414f275.zip
Update torrents info name on video update
Diffstat (limited to 'server/middlewares/error.ts')
-rw-r--r--server/middlewares/error.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/middlewares/error.ts b/server/middlewares/error.ts
index 6c52ce7bd..34c87a26d 100644
--- a/server/middlewares/error.ts
+++ b/server/middlewares/error.ts
@@ -1,5 +1,6 @@
1import express from 'express' 1import express from 'express'
2import { ProblemDocument, ProblemDocumentExtension } from 'http-problem-details' 2import { ProblemDocument, ProblemDocumentExtension } from 'http-problem-details'
3import { logger } from '@server/helpers/logger'
3import { HttpStatusCode } from '@shared/models' 4import { HttpStatusCode } from '@shared/models'
4 5
5function apiFailMiddleware (req: express.Request, res: express.Response, next: express.NextFunction) { 6function apiFailMiddleware (req: express.Request, res: express.Response, next: express.NextFunction) {
@@ -18,7 +19,8 @@ function apiFailMiddleware (req: express.Request, res: express.Response, next: e
18 19
19 res.status(status) 20 res.status(status)
20 res.setHeader('Content-Type', 'application/problem+json') 21 res.setHeader('Content-Type', 'application/problem+json')
21 res.json(new ProblemDocument({ 22
23 const json = new ProblemDocument({
22 status, 24 status,
23 title, 25 title,
24 instance, 26 instance,
@@ -28,7 +30,11 @@ function apiFailMiddleware (req: express.Request, res: express.Response, next: e
28 type: type 30 type: type
29 ? `https://docs.joinpeertube.org/api-rest-reference.html#section/Errors/${type}` 31 ? `https://docs.joinpeertube.org/api-rest-reference.html#section/Errors/${type}`
30 : undefined 32 : undefined
31 }, extension)) 33 }, extension)
34
35 logger.debug('Bad HTTP request.', { json })
36
37 res.json(json)
32 } 38 }
33 39
34 if (next) next() 40 if (next) next()