From 76148b27f7501bac061992136852be4303370c8d Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Tue, 1 Jun 2021 01:36:53 +0200 Subject: refactor API errors to standard error format --- server/typings/express/index.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'server/typings/express/index.d.ts') 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- import { HttpMethod } from '@shared/core-utils/miscs/http-methods' import { VideoCreate } from '@shared/models' import { File as UploadXFile, Metadata } from '@uploadx/core' +import { ProblemDocumentOptions } from 'http-problem-details/dist/ProblemDocument' import { RegisteredPlugin } from '../../lib/plugins/plugin-manager' import { MAccountDefault, @@ -83,8 +84,15 @@ declare module 'express' { filename: string } - // Extends locals property from Response + // Extends Response with added functions and potential variables passed by middlewares interface Response { + docs?: string + fail: (options: { + data?: Record + docs?: string + message: string + } & ProblemDocumentOptions) => void + locals: { videoAll?: MVideoFullLight onlyImmutableVideo?: MVideoImmutable -- cgit v1.2.3