server: improve error message for invalidating follows

This error was broken out to be a separate error code and message.

Changelog: Changed
This commit is contained in:
Johann150 2023-03-16 20:42:02 +01:00
parent d6837814d9
commit 32beda4344
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
2 changed files with 6 additions and 2 deletions

View file

@ -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);

View file

@ -340,6 +340,10 @@ export const errors: Record<string, { message: string, httpStatusCode: number }>
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,