diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-06-01 01:36:53 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-02 16:57:07 +0200 |
commit | 76148b27f7501bac061992136852be4303370c8d (patch) | |
tree | fc0559253e833c9252fa14ebaec5321d88bfb4e8 /server/typings | |
parent | 5ed25fb76e920dac364cb9ef46f14ec4bd372949 (diff) | |
download | PeerTube-76148b27f7501bac061992136852be4303370c8d.tar.gz PeerTube-76148b27f7501bac061992136852be4303370c8d.tar.zst PeerTube-76148b27f7501bac061992136852be4303370c8d.zip |
refactor API errors to standard error format
Diffstat (limited to 'server/typings')
-rw-r--r-- | server/typings/express/index.d.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server/typings/express/index.d.ts b/server/typings/express/index.d.ts index 55b6e0039..f58436ce1 100644 --- a/server/typings/express/index.d.ts +++ b/server/typings/express/index.d.ts | |||
@@ -22,6 +22,7 @@ import { MAccountVideoRateAccountVideo } from '@server/types/models/video/video- | |||
22 | import { HttpMethod } from '@shared/core-utils/miscs/http-methods' | 22 | import { HttpMethod } from '@shared/core-utils/miscs/http-methods' |
23 | import { VideoCreate } from '@shared/models' | 23 | import { VideoCreate } from '@shared/models' |
24 | import { File as UploadXFile, Metadata } from '@uploadx/core' | 24 | import { File as UploadXFile, Metadata } from '@uploadx/core' |
25 | import { ProblemDocumentOptions } from 'http-problem-details/dist/ProblemDocument' | ||
25 | import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' | 26 | import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' |
26 | import { | 27 | import { |
27 | MAccountDefault, | 28 | MAccountDefault, |
@@ -83,8 +84,15 @@ declare module 'express' { | |||
83 | filename: string | 84 | filename: string |
84 | } | 85 | } |
85 | 86 | ||
86 | // Extends locals property from Response | 87 | // Extends Response with added functions and potential variables passed by middlewares |
87 | interface Response { | 88 | interface Response { |
89 | docs?: string | ||
90 | fail: (options: { | ||
91 | data?: Record<string, Object> | ||
92 | docs?: string | ||
93 | message: string | ||
94 | } & ProblemDocumentOptions) => void | ||
95 | |||
88 | locals: { | 96 | locals: { |
89 | videoAll?: MVideoFullLight | 97 | videoAll?: MVideoFullLight |
90 | onlyImmutableVideo?: MVideoImmutable | 98 | onlyImmutableVideo?: MVideoImmutable |