diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-02 18:15:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-02 18:15:41 +0200 |
commit | e030bfb59dd5ee65f20a64686ec9b22ca39f70ae (patch) | |
tree | c9a439159ef540291e3c030bcaf958b953442147 /server/typings/express/index.d.ts | |
parent | 463206948d6a9d46e7e68d55c7b763e601ecc870 (diff) | |
download | PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.tar.gz PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.tar.zst PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.zip |
Refactor server errors handler
Diffstat (limited to 'server/typings/express/index.d.ts')
-rw-r--r-- | server/typings/express/index.d.ts | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/server/typings/express/index.d.ts b/server/typings/express/index.d.ts index f58436ce1..cbbf40a78 100644 --- a/server/typings/express/index.d.ts +++ b/server/typings/express/index.d.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | import { RegisterServerAuthExternalOptions } from '@server/types' | 2 | import { RegisterServerAuthExternalOptions } from '@server/types' |
2 | import { | 3 | import { |
3 | MAbuseMessage, | 4 | MAbuseMessage, |
@@ -20,9 +21,8 @@ import { MVideoImportDefault } from '@server/types/models/video/video-import' | |||
20 | import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element' | 21 | import { MVideoPlaylistElement, MVideoPlaylistElementVideoUrlPlaylistPrivacy } from '@server/types/models/video/video-playlist-element' |
21 | import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate' | 22 | import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video-rate' |
22 | import { HttpMethod } from '@shared/core-utils/miscs/http-methods' | 23 | import { HttpMethod } from '@shared/core-utils/miscs/http-methods' |
23 | import { VideoCreate } from '@shared/models' | 24 | import { PeerTubeProblemDocumentData, ServerErrorCode, VideoCreate } from '@shared/models' |
24 | import { File as UploadXFile, Metadata } from '@uploadx/core' | 25 | import { File as UploadXFile, Metadata } from '@uploadx/core' |
25 | import { ProblemDocumentOptions } from 'http-problem-details/dist/ProblemDocument' | ||
26 | import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' | 26 | import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' |
27 | import { | 27 | import { |
28 | MAccountDefault, | 28 | MAccountDefault, |
@@ -41,6 +41,7 @@ import { | |||
41 | MVideoThumbnail, | 41 | MVideoThumbnail, |
42 | MVideoWithRights | 42 | MVideoWithRights |
43 | } from '../../types/models' | 43 | } from '../../types/models' |
44 | |||
44 | declare module 'express' { | 45 | declare module 'express' { |
45 | export interface Request { | 46 | export interface Request { |
46 | query: any | 47 | query: any |
@@ -86,14 +87,20 @@ declare module 'express' { | |||
86 | 87 | ||
87 | // Extends Response with added functions and potential variables passed by middlewares | 88 | // Extends Response with added functions and potential variables passed by middlewares |
88 | interface Response { | 89 | interface Response { |
89 | docs?: string | ||
90 | fail: (options: { | 90 | fail: (options: { |
91 | data?: Record<string, Object> | ||
92 | docs?: string | ||
93 | message: string | 91 | message: string |
94 | } & ProblemDocumentOptions) => void | 92 | |
93 | title?: string | ||
94 | status?: number | ||
95 | type?: ServerErrorCode | ||
96 | instance?: string | ||
97 | |||
98 | data?: PeerTubeProblemDocumentData | ||
99 | }) => void | ||
95 | 100 | ||
96 | locals: { | 101 | locals: { |
102 | docUrl?: string | ||
103 | |||
97 | videoAll?: MVideoFullLight | 104 | videoAll?: MVideoFullLight |
98 | onlyImmutableVideo?: MVideoImmutable | 105 | onlyImmutableVideo?: MVideoImmutable |
99 | onlyVideo?: MVideoThumbnail | 106 | onlyVideo?: MVideoThumbnail |