From de3c6d00e6280a1b256f6245745d8658a4a6b213 Mon Sep 17 00:00:00 2001 From: Luna Date: Sat, 8 Dec 2018 18:48:27 -0300 Subject: [PATCH] relationships: add RelationshipBlocked Related to #30. Fixes parent commit --- litecord/blueprints/relationships.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/litecord/blueprints/relationships.py b/litecord/blueprints/relationships.py index f22437d..0544342 100644 --- a/litecord/blueprints/relationships.py +++ b/litecord/blueprints/relationships.py @@ -23,6 +23,7 @@ from asyncpg import UniqueViolationError from ..auth import token_check from ..schemas import validate, RELATIONSHIP, SPECIFIC_FRIEND from ..enums import RelationshipType +from litecord.errors import BadRequest bp = Blueprint('relationship', __name__) @@ -149,6 +150,10 @@ class RelationshipFailed(BadRequest): error_code = 80004 +class RelationshipBlocked(BadRequest): + error_code = 80001 + + @bp.route('/@me/relationships', methods=['POST']) async def post_relationship(): user_id = await token_check() @@ -162,9 +167,8 @@ async def post_relationship(): res = await make_friend(user_id, uid) - # NOTE: don't know what status code should I send if res is None: - return '', 500 + raise RelationshipBlocked() return '', 204