diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-08 11:32:45 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-08 16:12:49 +0100 |
commit | 38d69d65012c8bf01bceb672be99f94fe414f275 (patch) | |
tree | 80ba6d43c4ce7ccff0c64d0c0817f43cc02a6531 /server/middlewares/error.ts | |
parent | 9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231 (diff) | |
download | PeerTube-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.ts | 10 |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { ProblemDocument, ProblemDocumentExtension } from 'http-problem-details' | 2 | import { ProblemDocument, ProblemDocumentExtension } from 'http-problem-details' |
3 | import { logger } from '@server/helpers/logger' | ||
3 | import { HttpStatusCode } from '@shared/models' | 4 | import { HttpStatusCode } from '@shared/models' |
4 | 5 | ||
5 | function apiFailMiddleware (req: express.Request, res: express.Response, next: express.NextFunction) { | 6 | function 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() |