From 32beda4344a1ac08e7612111ceaa9ad912120379 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Thu, 16 Mar 2023 20:42:02 +0100 Subject: [PATCH] server: improve error message for invalidating follows This error was broken out to be a separate error code and message. Changelog: Changed --- .../backend/src/server/api/endpoints/following/invalidate.ts | 4 ++-- packages/backend/src/server/api/error.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/following/invalidate.ts b/packages/backend/src/server/api/endpoints/following/invalidate.ts index 6287b2071..beeb1eb15 100644 --- a/packages/backend/src/server/api/endpoints/following/invalidate.ts +++ b/packages/backend/src/server/api/endpoints/following/invalidate.ts @@ -17,7 +17,7 @@ export const meta = { kind: 'write:following', - errors: ['FOLLOWER_IS_YOURSELF', 'NO_SUCH_USER', 'NOT_FOLLOWING'], + errors: ['FOLLOWER_IS_YOURSELF', 'NO_SUCH_USER', 'NOT_FOLLOWED'], res: { type: 'object', @@ -53,7 +53,7 @@ export default define(meta, paramDef, async (ps, user) => { followeeId: followee.id, }); - if (!exist) throw new ApiError('NOT_FOLLOWING'); + if (!exist) throw new ApiError('NOT_FOLLOWED'); await deleteFollowing(follower, followee); diff --git a/packages/backend/src/server/api/error.ts b/packages/backend/src/server/api/error.ts index 7636ab0ba..4af16383b 100644 --- a/packages/backend/src/server/api/error.ts +++ b/packages/backend/src/server/api/error.ts @@ -340,6 +340,10 @@ export const errors: Record message: 'You are not following that user.', httpStatusCode: 409, }, + NOT_FOLLOWED: { + message: 'You are not followed by that user.', + httpStatusCode: 409, + }, NOT_LIKED: { message: 'You have not liked that page.', httpStatusCode: 409,