This commit is contained in:
syuilo 2022-02-04 02:06:24 +09:00
parent 21cce18d36
commit d21b28b159
3 changed files with 12 additions and 4 deletions

View file

@ -86,7 +86,9 @@ export default define(meta, async (ps, user, _, file, cleanup) => {
const driveFile = await addFile({ user, path: file.path, name, comment: ps.comment, folderId: ps.folderId, force: ps.force, sensitive: ps.isSensitive });
return await DriveFiles.pack(driveFile, { self: true });
} catch (e) {
apiLogger.error(e);
if (e instanceof Error || typeof e === 'string') {
apiLogger.error(e);
}
throw new ApiError();
} finally {
cleanup!();

View file

@ -6,6 +6,7 @@ import define from '../../define';
import { ApiError } from '../../error';
import { getUser } from '../../common/getters';
import { Followings, Users } from '@/models/index';
import { IdentifiableError } from '@/misc/identifiable-error';
export const meta = {
tags: ['following', 'users'],
@ -92,8 +93,10 @@ export default define(meta, async (ps, user) => {
try {
await create(follower, followee);
} catch (e) {
if (e.id === '710e8fb0-b8c3-4922-be49-d5d93d8e6a6e') throw new ApiError(meta.errors.blocking);
if (e.id === '3338392a-f764-498d-8855-db939dcf8c48') throw new ApiError(meta.errors.blocked);
if (e instanceof IdentifiableError) {
if (e.id === '710e8fb0-b8c3-4922-be49-d5d93d8e6a6e') throw new ApiError(meta.errors.blocking);
if (e.id === '3338392a-f764-498d-8855-db939dcf8c48') throw new ApiError(meta.errors.blocked);
}
throw e;
}

View file

@ -5,6 +5,7 @@ import define from '../../../define';
import { ApiError } from '../../../error';
import { getUser } from '../../../common/getters';
import { Users } from '@/models/index';
import { IdentifiableError } from '@/misc/identifiable-error';
export const meta = {
tags: ['following', 'account'],
@ -51,7 +52,9 @@ export default define(meta, async (ps, user) => {
try {
await cancelFollowRequest(followee, user);
} catch (e) {
if (e.id === '17447091-ce07-46dd-b331-c1fd4f15b1e7') throw new ApiError(meta.errors.followRequestNotFound);
if (e instanceof IdentifiableError) {
if (e.id === '17447091-ce07-46dd-b331-c1fd4f15b1e7') throw new ApiError(meta.errors.followRequestNotFound);
}
throw e;
}