mirror of
https://github.com/misskey-dev/misskey
synced 2024-05-20 02:09:53 +02:00
refactor(backend): encapsulate any
affection in ApiCallService.ts
This commit is contained in:
parent
27f823e882
commit
4711e1a33f
|
@ -220,11 +220,18 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
private async call(
|
||||
ep: IEndpoint & { exec: any },
|
||||
private async call<Data>(
|
||||
ep: IEndpoint & { exec: (
|
||||
data: Data,
|
||||
user: MiLocalUser,
|
||||
token: MiAccessToken | null | undefined,
|
||||
file: { name: string, path: string } | null,
|
||||
ip: any,
|
||||
headers: any
|
||||
) => Promise<any> },
|
||||
user: MiLocalUser | null | undefined,
|
||||
token: MiAccessToken | null | undefined,
|
||||
data: any,
|
||||
data: Data,
|
||||
file: {
|
||||
name: string;
|
||||
path: string;
|
||||
|
@ -362,7 +369,7 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
// API invoking
|
||||
return await ep.exec(data, user, token, file, request.ip, request.headers).catch((err: Error) => {
|
||||
return await ep.exec(data, user, token, file, request.ip, request.headers).catch((err) => {
|
||||
if (err instanceof ApiError || err instanceof AuthenticationError) {
|
||||
throw err;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue